This repo provides Terraform templates for deploying a Kubernetes cluster against AWS using EKS
- Terraform
- AWS CLI
- Kubectl
Make sure environment variables AWS_PROFILE
and AWS_DEFAULT_REGION
point to the corresponding AWS credentials/region
export AWS_PROFILE=sandbox
export AWS_DEFAULT_REGION=us-west-2
-
Review terraform/variables.tf and adjust as needed
-
Provision VPC and cluster
cd terraform terraform init terraform apply
-
Authenticate to Cluster
aws eks update-kubeconfig --name sandbox-eks-cluster --region $AWS_DEFAULT_REGION
-
Register nodes to the cluster
terraform output config_map_aws_auth > config_map_aws_auth.yml kubectl apply -f config_map_aws_auth.yml
-
Validate by checking the created cluster nodes (it might take a minute to show 'Ready' status)
kubectl get nodes
-
Provide access to other IAM users/roles that require it (see https://aws.amazon.com/premiumsupport/knowledge-center/amazon-eks-cluster-access/)
kubectl edit configmap aws-auth -n kube-system
(IAM users should authenticate to the cluster after this step is completed)
aws eks --region $AWS_DEFAULT_REGION update-kubeconfig --name sandbox-eks-cluster
This template does not currently include an Ingress controller. One can be deployed, eg for Nginx, using
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.32.0/deploy/static/provider/aws/deploy.yaml
kubectl get all -n ingress-nginx
Notice that this is deployed outside of Terraform, so it needs to be manually deleted before removing the cluster.
โ WARNING: You will delete your cluster with this steps.
If you want to destroy the cluster execute:
terraform destroy
See airflow/README.md for information about how to install airflow in this cluster.
โ WARNING: Your cluster will be turned off if you follow this steps.
If you want to turn off the instances go to Amazon's web console -> EC2 -> Autoscaling group and edit the configuration, setting up 0 instances for 'Desired capacity' and 'Minimum capacity' fields.