Friday, September 11, 2020

Kubernetes cluster creation with Command line interface (eksctl) & Deployment on it.


EKSCTL:

eksctl is a simple CLI utility for creating clusters on EKS - Amazon's new managed Kubernetes service for EC2. It is written in Go, and uses Cloud Formation internally, EKS supports versions 1.14, 1.15, 1.16 and 1.17 (default). With eksctl we can deploy any of the supported versions by passing --version. we can create a cluster in minutes with just run the command.

it is the one of the Kubernates cluster deployment model.

lets gets started step by step to configure and create the Kubernetes cluster.

  1. Install the AWS cli
  2. Configure your AWS cli credentials
  3. Install eksctl
  4. Install and configure kubectl 
  5. Create Amazon EKS cluster 

Install AWS-CLI:

        curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

        unzip awscliv2.zip

        sudo ./aws/install

        verify the Version : awscli --version

Configuring aws-cli :

Execute   aws configure and provide the below details 

AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXXXX

AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXX

Default region name [None]: us-east-1

Default output format [None]: json

to verify AWS-Cli is working or not with the below command

aws ec2  describe-vpcs |jq


Install EKSCTL :

     curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /root

     mv /root/eksctl  to /usr/local/bin
 
    eksctl version


Install & configure kubectl:


curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.9/2020-08-04/bin/linux/amd64/kubectl

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin

mkdir -p $HOME/bin && mv ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin

echo 'export PATH=$PATH:$HOME/bin' >> ~/.bash_profile

kubectl version --short --client


Create Amazon EKS Cluster:

eksctl create cluster --name my-cluster --version 1.17 --region us-east-1 --nodegroup-name linux-nodes --nodes 3 --nodes-min 1 --nodes-max 4 --ssh-access --ssh-public-key eks --managed



now verify the Kubernetes nodes


from console:

EC2:


to check the status of the pods from the kube-system namespace.


Deployment:

I have created the deployment and executed the below command,thats helps to deploy our application in kuberetes cluster.

kubectl create -f test.yaml



Testing the application after the deployment:

http://a4845c370e711464496c8f4548dedf72-1538913927.us-east-1.elb.amazonaws.com/

To delete the created cluster using the below command.

eksctl delete cluster --name my-cluster




Reference:  

https://eksctl.io/introduction/






No comments:

Post a Comment