* Validation added to cluster_name variable * Update ref to eks-cluster-with-vpc on v4.13.1 (#121) * Added cluster_name validation with message (#118) * Error message typo fixed to follow the standards. * Adding requested new line at the end
EKS Cluster Deployment with new VPC
Note: This example is a subset from this EKS Blueprint example
This example deploys the following Basic EKS Cluster with VPC
- Creates a new sample VPC, 3 Private Subnets and 3 Public Subnets
- Creates Internet gateway for Public Subnets and NAT Gateway for Private Subnets
- Creates EKS Cluster Control plane with one managed node group
How to Deploy
Prerequisites
Ensure that you have installed the following tools in your Mac or Windows Laptop before start working with this module and run Terraform Plan and Apply
Minimum IAM Policy
Note
: The policy resource is set as
*to allow all resources, this is not a recommended practice.
You can find the policy here
Deployment Steps
Step 1: Clone the repo using the command below
git clone https://github.com/aws-observability/terraform-aws-observability-accelerator.git
Step 2: Run Terraform INIT
Initialize a working directory with configuration files
cd examples/eks-cluster-with-vpc/
terraform init
Step 3: Run Terraform PLAN
Verify the resources created by this execution
export TF_VAR_aws_region=<ENTER YOUR REGION> # Select your own region
terraform plan
Step 4: Finally, Terraform APPLY
Deploy the pattern
terraform apply
Enter yes to apply.
Configure kubectl and test cluster
EKS Cluster details can be extracted from terraform output or from AWS Console to get the name of cluster.
This following command used to update the kubeconfig in your local machine where you run kubectl commands to interact with your EKS Cluster.
Step 5: Run update-kubeconfig command
~/.kube/config file gets updated with cluster details and certificate from the below command
aws eks --region <enter-your-region> update-kubeconfig --name <cluster-name>
Step 6: List all the worker nodes by running the command below
kubectl get nodes
Step 7: List all the pods running in kube-system namespace
kubectl get pods -n kube-system
Cleanup
To clean up your environment, destroy the Terraform modules in reverse order.
Destroy the Kubernetes Add-ons, EKS cluster with Node groups and VPC
terraform destroy -target="module.eks_blueprints_kubernetes_addons" -auto-approve
terraform destroy -target="module.eks_blueprints" -auto-approve
terraform destroy -target="module.vpc" -auto-approve
Finally, destroy any additional resources that are not in the above modules
terraform destroy -auto-approve