This repository provides an automated Terraform-based installation of k0s with Cilium as the CNI, along with AWS integrations such as:
- AWS Cloud Controller Manager
- AWS EBS CSI Driver
- AWS EBS StorageClass
By using this Terraform setup, you can quickly deploy a k0s cluster on AWS with cloud provider integration, networking via Cilium, and persistent storage via EBS.
Before proceeding with the installation, ensure you have the following:
- An AWS account with required IAM permissions.
- Terraform (
>=0.14.3) installed. kubectlinstalled and configured.k0sctlinstalled for cluster configuration management.
The entire deployment, including AWS EC2 instances, security groups, key pairs, and k0s configuration, is managed via Terraform.
terraform initterraform apply -auto-approveterraform output -raw k0s_cluster | k0sctl apply --no-wait --debug --config -terraform output -raw k0s_cluster | k0sctl kubeconfig --config -You can save the kubeconfig in a file for the use with kubectl or just just run k0sctl e.g. terraform output -raw k0s_cluster | k0sctl kc get no
This Terraform configuration does the following:
- Creates an AWS Key Pair for SSH access.
- Generates a TLS private key for authentication.
- Provisions EC2 instances for controllers and workers.
- Configures AWS Security Groups to allow necessary traffic.
- Deploys k0s with external cloud provider integration.
- Installs Cilium, AWS Cloud Controller Manager, and EBS CSI Driver via Helm.
The Terraform module includes:
- Key Pair Management: Creates an SSH key pair and saves the private key locally.
- Security Group Setup: Allows SSH access and required network traffic.
- Dynamic k0s Cluster Configuration: Generates the k0s configuration dynamically with Helm charts for required services.
- Storage Setup: Configures AWS EBS StorageClass for persistent storage.
After installation, verify the components:
kubectl get nodes --kubeconfig config
kubectl get pods -n kube-system --kubeconfig config
kubectl get storageclass --kubeconfig configEnsure that Cilium is correctly managing networking:
cilium statusContributions are welcome! To contribute:
- Fork this repository.
- Create a new branch (
feature/your-feature-name). - Commit your changes (
git commit -m 'Add new feature'). - Push to your branch (
git push origin feature/your-feature-name). - Open a pull request.
For major changes, please open an issue first to discuss your ideas.
This project is open-source and available under the MIT License.
- Make iam_instance_profile configurable
- Make AMI configurable