This project uses terraform workspaces https://app.terraform.io/.
User terraform cli to setup locally.
terraform init
# terraform workspace list
# terraform workspace select prod|stage
terraform plan | apply # to make changes
To configure kubectl, you need both kubectl and AWS IAM Authenticator.
The following command will get the access credentials for your cluster and automatically
configure kubectl
.
$ aws eks --region us-west-2 update-kubeconfig
You can view these outputs again by running:
$ terraform output
kubectl apply -f kube2iam/serviceaccount.yaml
kubectl apply -f kube2iam/clusterrole.yaml
kubectl apply -f kube2iam/daemonset.yaml
The Kubernetes Metrics Server, used to gather metrics such as cluster CPU and memory usage over time, is not deployed by default in EKS clusters.
Download and unzip the metrics server by running the following command.
helm install metrics-server stable/metrics-server \
--namespace kube-system \
-f metrics-server/values.yaml
kubectl apply -f kube2iam/serviceaccount.yaml
kubectl apply -f kube2iam/clusterrole.yaml
kubectl apply -f kube2iam/daemonset.yaml
helm install cluster-autoscaler --namespace kube-system autoscaler/cluster-autoscaler-chart --values=misc/cluster-autoscaler-chart-values.yaml
More info on scaling down