November 11, 2024
Creating Kubenetes cluster in AWS have multiple options like using AWS SDK, Terraform, Cloudformation and easy and quick for new learner using AWS Console. In this blog we going see another well know method of creating AWS EKS cluster using “eksctl” command by using as YAML configuration in default VPC. ( Same can be create by CLI command).
Let install these binary one by one
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg ./AWSCLIV2.pkg -target /
which aws
aws --version
username: kubedeveloper
No AWS console access, Only programmatic access
Step 2.6 Select Use case :
Command Line Interface (CLI) & check the Confirmation
Now we got AccessKey and SecretAccessKey,
Note: if multiple aws account configured, use — profile
$ aws configure
Run any aws command to list resources
Here eg: To list s3 buckets on my AWS account
bala@kubelancer Downloads % aws s3 ls
bala@kubelancer Downloads % aws s3 ls
2022-12-13 21:36:02 firehose-backup-05bf6840
bala@kubelancer Downloads %
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_Darwin_arm64.tar.gz"
tar -xzvf eksctl_Darwin_arm64.tar.gz
sudo mv ./eksctl /usr/local/bin
Ref: https://www.weave.works/oss/eksctl/
$ vi cluster-config.yamlapiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: kubelancer-cluster-1
region: us-east-1
nodeGroups:
- name: ng-1
instanceType: t4g.medium
desiredCapacity: 2
volumeSize: 20
ssh:
allow: false
$ eksctl create cluster -f cluster-config.yaml
Note: if multiple aws account configured, use — profile
eksctl interact with AWS API and get the required details from AWS cloud
$ eksctl get cluster --profile kubedev
$ aws eks update-kubeconfig --name=kubelancer-cluster-1 --region=us-east-1
kubectl get nodes
$ kubectl get poddisruptionbudget -A
$ kubectl delete poddisruptionbudget coredns -n kube-system
$ eksctl delete cluster -f cluster-config.yaml --profile kubedev
Bala Subramani K
Founder & CEO of Kubelancer Private Limited
Senior DevOps Engineer / Multi-Cloud Solution Architect / Infrastructure Specialist