This repo is inspired by Amazon EKS Blueprints for Terraform.
This project includes the following components:
-
EKS version =
1.24
(this value is defined interraform.tfvars
) -
Both public and private access endpoints enabled
-
Terraform state file saved in a S3 bucket
-
Required Terraform version is
>= 1.3.7
-
The following Amazon EKS add-ons are enabled:
- enable_amazon_eks_coredns
- enable_amazon_eks_kube_proxy
- enable_amazon_eks_vpc_cni
- enable_amazon_eks_aws_ebs_csi_driver
-
The following K8s Add-ons
- enable_metrics_server
- enable_karpenter
- enable_aws_cloudwatch_metrics
- enable_aws_efs_csi_driver
- enable_aws_node_termination_handler
- enable_tetrate_istio
- enable_calico
- enable_kubecost
- enable_kubernetes_dashboard (in kube-system namespace)
- Still need to figure out how to use this kubernetes web UI Dashboard
- An AWS account
- A configured AWS CLI
- AWS IAM Authenticator
- kubectl
- Ensure that AWS credentials are available at: "~/.aws/credentials" on the host dev machine
[default]
aws_access_key_id = <KEY>
aws_secret_access_key = <SECRET>
region = <REGION>
- Ensure that an S3 bucket as a backend type is created inversions.tf. See the docs here
terraform {
backend "s3" {
key = "eks/terraform.tfstate"
region = "<REGION>"
encrypt = true
# Lock Terraform State with S3 bucket in DynamoDB - https://www.terraform.io/docs/language/settings/backends/s3.html#dynamodb-state-locking
dynamodb_table = "statefile"
}
}
- Ensure a globally unique S3 bucket name already exists that is specific to your environment in environments/dev/backend.tf
Run the following command to set up the cluster
export environment=dev
# Initialize Terraform workspace
terraform init -backend-config=environments/${environment}/backend.tf
# Review the planned actions before continuing
terraform apply --var-file=environments/${environment}/${environment}.tfvars
# Configure kubectl
aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)
terraform apply -destroy -var-file=environments/${environment}/${environment}.tfvars
Doc for enabling this add-on is on this page:https://aws-ia.github.io/terraform-aws-eks-blueprints/v4.21.0/add-ons/kube-state-metrics/. It appears that this particular add-on is currently disabled and the blueprint docs have yet to be (annoyingly) corrected. Here is the closed issue: aws-ia/terraform-aws-eks-blueprints#464 (comment)
Error: Unsupported argument
on kubernetes_addons.tf line 23, in module "eks_blueprints_kubernetes_addons":
23: enable_kube_state_metrics = true
An argument named "enable_kube_state_metrics" is not expected here.
- Amazon EKS - User Guide
- EKS Best Practices - Guides
- Bootstrapping clusters with EKS Blueprints blog
- AWS EKS Blueprints for Terraform - docs
- AWS EKS Blueprints for Terraform - GitHub repo`
- AWS EKS Blueprints for Terraform - YouTube