Monday, October 12, 2020

Create Amazon EKS cluster by eksctl | How to create Amazon EKS cluster using EKSCTL | Create EKS Cluster in command line

What is Amazon EKS

Amazon EKS is a fully managed container orchestration service. EKS allows you to quickly deploy a production ready Kubernetes cluster in Azure, deploy and manage containerized applications more easily with a fully managed Kubernetes service. 

EKS takes care of Master node/Control plane. We need to manage worker nodes.

Please watch the steps in YouTube channel:

Pre-requistes:

You can use Windows, Macbook or any Ubuntu or Red Hat EC2 instance to setup the below tools.

  • Install AWS CLI – Command line tools for working with AWS services, including Amazon EKS.

  • Install eksctl – A command line tool for working with EKS clusters that automates many individual tasks.

install kubectl – A command line tool for working with Kubernetes clusters. 

Once you install all of the above, you need to have AWS credentials configured in your environment. The aws configure command is the fastest way to set up your AWS CLI installation for general use. 

aws configure 

the AWS CLI prompts you for four pieces of information: access key, secret access key, AWS Region, and output format.

Create EKS Cluster using eksctl

eksctl create cluster --name demo-eks --region us-east-2 --nodegroup-name my-nodes --node-type t3.small --managed

the above command should create a EKS cluster in AWS, it might take 5 to 10 mins. The eksctl tool uses CloudFormation under the hood, creating one stack for the EKS master control plane and another stack for the worker nodes. 

Connect to EKS cluster

kubectl get nodes

kubectl get ns

Deploy Nginx on a Kubernetes Cluster
Let us run some apps to make sure they are deployed to Kuberneter cluster. The below command will create deployment:

kubectl create deployment nginx --image=nginx


View Deployments
kubectl get deployments

Delete EKS Cluster using eksctl

eksctl delete cluster --name demo-eks --region us-east-2 

the above command should delete the EKS cluster in AWS, it might take a few mins to clean up the cluster.

Errors during Cluster creation
If you are having issues when creating a cluster, try to delete the cluster by executing the below command and re-create it.

eksctl delete cluster --name demo-eks --region us-east-2 


or login to AWS console --> AWS Cloudformation --> delete the stack manually.

No comments:

Post a Comment

DevOps Coaching Program Model Information | AWS Cloud Azure Cloud DevOps Coaching Program Model Information

Thanks for showing interest in learning DevOps. Believe it or not, anyone can become a successful DevOps engineer after finishing the excit...