DEV Community

Cover image for How to Create An Amazon EKS - Step by Step for Beginners
On-cloud7
On-cloud7

Posted on

How to Create An Amazon EKS - Step by Step for Beginners

What is Amazon EKS?

Amazon EKS: Simplified Kubernetes Management

Amazon Elastic Kubernetes Service (EKS) provides a fully managed Kubernetes service that eliminates the complexity of operating Kubernetes clusters. With EKS, you can:

Deploy applications faster with less operational overhead

Scale seamlessly to meet changing workload demands

Improve security through AWS integration and automated updates

Choose between standard EKS or fully automated EKS Auto Mode

>> Here are the Steps to Create a EKS Cluster from Scratch:

Pre-requisites:

_Step 1:Create a Ec2 Instance So that we can Configure AWS CLI, Eksctl,kubectl on it _
**
**_Step 2: Connect the EC2 with the help of SSH _

_Step 3: Create a IAM User give permissions to the user and create a Access key _

Step 4 : Configue the AWS CLI in the EC2 Instance

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install unzip
unzip awscliv2.zip
sudo ./aws/install
aws configure
Enter fullscreen mode Exit fullscreen mode

_Step 5: Install the Kubectl in the EC2 Instance _

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --client
Enter fullscreen mode Exit fullscreen mode

Step 6: Install the Eksctl in the EC2 Instance

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl version
Enter fullscreen mode Exit fullscreen mode

Steps to create EKS cluster:

Step 7: Create EKS Cluster

eksctl create cluster --name=my-cluster \
                      --region=us-west-2 \
                      --version=1.30 \
                      --without-nodegroup
Enter fullscreen mode Exit fullscreen mode

Step 8:Associate IAM OIDC Provider :It means connecting an external identity provider (OIDC)—like GitHub, Kubernetes (EKS), or any OIDC-supported service—to AWS IAM so that those users or services can securely request temporary AWS permissions without using long-term AWS keys.

eksctl utils associate-iam-oidc-provider \
    --region us-west-2 \
    --cluster my-cluster \
    --approve
Enter fullscreen mode Exit fullscreen mode

Step 9:Create Nodegroup in the EC2 instance

eksctl create nodegroup --cluster=my-cluster \
                       --region=us-west-2 \
                       --name=my-cluster \
                       --node-type=t2.medium \
                       --nodes=2 \
                       --nodes-min=2 \
                       --nodes-max=2 \
                       --node-volume-size=29 \
                       --ssh-access \
                       --ssh-public-key=eks-nodegroup-key 
Enter fullscreen mode Exit fullscreen mode

Note: Make sure the ssh-public-key "eks-nodegroup-key is available in your aws account"

step 10: Update Kubectl Context

aws eks update-kubeconfig --region us-west-2 --name my-cluster
Enter fullscreen mode Exit fullscreen mode

Step 11:Delete EKS Cluster

eksctl delete cluster --name=my-cluster --region=us-west-2
Enter fullscreen mode Exit fullscreen mode

Reference:

1.https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html
2.https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-eks-cluster.html
3.https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html
4.https://github.com/On-cloud7/kubestarter/blob/main/eks_cluster_setup.md

Top comments (0)