-
Notifications
You must be signed in to change notification settings - Fork 1
1.3 Setting Kubernetes Cluster On AWS EKS using eksctl
deepak gupta edited this page Nov 25, 2021
·
1 revision
We are going to see the following topics :
- Configure AWS Credentials
- Install kubectl
- Install eksctl
- Create Kubernetes Cluster
- Test Kubernetes Cluster
- Delete Kubernetes Cluster
Here, we are starting :
- Configure AWS Credentials : Before configuring, you need AWSCLI.
$ aws configure
AWS Access Key ID [None]: XXXXXXX
AWS Secret Access Key [None]: XXXXX
Default region name [None]: us-east-1. #region is your choice
Default output format [None]: json
- Install kubectl : To interact with the Kubernetes cluster we need a client tool. That is kubectl. Download kubectl. For any specific release
$ curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ mv kubectl /usr/local/bin/
$ kubectl version --short --client
- Install eksctl : eksctl is CLI for AWS EKS. Download and extract eksctl.
$ curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
$ mv /tmp/eksctl /usr/local/bin
$ eksctl version
- Create Kubernetes Cluster : Everything is ready. Now we can create a Kubernetes cluster on AWS EKS using the eksctl.
eksctl create cluster \
--name OT-EKS \
--version 1.21 \
--region us-east-1 \
--nodegroup-name OT-Nodes \
--node-type t2.micro \
--nodes 2
Approximately it will take 15-20 mins to create the Kubernetes cluster.
- Test Kubernetes Cluster : Now the Kubernetes cluster is ready. Now we can issue few commands using kubectl. By default, the Kubernetes cluster credentials are stored in the “/root/.kube/config” folder. The kubectl will take the credentials from the config file.
Get the list of nodes in the Kubernetes cluster.
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-192-168-27-190.ec2.internal Ready <none> 3m14s v1.21.5-eks-bc4871b
ip-192-168-33-248.ec2.internal Ready <none> 3m2s v1.21.5-eks-bc4871b
Get the list of the namespace.
$ kubectl get ns
NAME STATUS AGE
default Active 12m
kube-node-lease Active 12m
kube-public Active 12m
kube-system Active 12m
etc...
- Delete Kubernetes Cluster : Use the AWS EKS cluster name and region name to delete the Kubernetes cluster using the eksctl.
eksctl delete cluster --name OT-EKS --region us-east-1