Files
terraform-aws-observability…/docs/helpers/new-eks-cluster.md
T
Rodrigue Koffi e73b4b9300 Public doc site references update (#77)
* Update with doc site

* Use full link

* Fix dead links
2023-01-10 20:49:38 +01:00

2.1 KiB

Creating a new Amazon EKS cluster with VPC

Note: This example is a subset from this EKS Blueprint example

This example deploys the following:

  • New sample VPC, 3 Private Subnets and 3 Public Subnets
  • Internet gateway for Public Subnets and NAT Gateway for Private Subnets
  • EKS Cluster Control plane with one managed node group

Prerequisites

Make sure to complete the prerequisites section before proceeding.

Setup

1. Download sources and initialize Terraform

git clone https://github.com/aws-observability/terraform-aws-observability-accelerator.git
cd examples/eks-cluster-with-vpc/
terraform init

2. AWS Region

Specify the AWS Region where the resources will be deployed:

export TF_VAR_aws_region=xxx

Deploy

Simply run this command to deploy the example

terraform apply

Login to your cluster

EKS Cluster details can be extracted from terraform output or from AWS Console to get the name of cluster. Use the following commands in your local machine where you want to interact with your EKS Cluster.

1. 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>

2. List all the worker nodes by running the command below

kubectl get nodes

3. 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