Hi folks, to create an EKS cluster, you require a launch pad, for today we shall be using an Amazon Linux 2 EC2 server as our eks launchpad. There are few pre-requisites we require to take care of -
- kubectl: Kubernetes Client to communicate with the Kubernetes API Server.
Installing kubectl: [Source: Installing kubectl - AWS Docs]
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 mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc kubectl version --client
- eksctl: The official Amazon EKS CLI, used to create and manage multiple EKS Clusters.
Installing eksctl: [Source: Installing eksctl - eksctl docs]
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 export PATH=$PATH:/usr/local/bin echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc eksctl version
Create an IAM Role for EC2 with following IAM policies:
Source : eksctl doc
Once the Role is created you can attach the role onto your EKS Launch Pad Server.
Create a file named cluster.yaml with the following configuration: Source: My GitHub - cluster.yaml
Run eks create cluster with dry run
eksctl create cluster -f cluster.yaml --dry-run
[ This shall help you identify any errors on the config files or related to your permission, make sure you don't have additional aws user configured with less privileges than the privileges allowed in the EC2 attached role. ]
- Launch your cluster with
eksctl create cluster -f cluster.yaml
- You need to wait for a few minutes and you shall see on the screen the CFN Stack is being deployed
The CFN stack creates the EKS Control Plane, SG's, Policies and Service Roles. It also creates a single nodegroup or more as mentioned in the cluster config.
If you encounter any issues check the Cloudformation Console or try:
eksctl utils describe-stacks --region=Your-Region --cluster=Your-Cluster-Name
I hope you enjoyed the blog, if you face any issues please reach out to me on LinkedIn and we can discuss the same, thanks!
You can follow me to get updated on new AWS related blogs in the coming weeks, also I am an earth buddy, don't know what that is, check this out: Save our Soil