Member-only story

Building EKS Kubernetes cluster with eksctl

Madeesha’s Tech Space
2 min readDec 1, 2022

--

“eksctl” is a very popular and useful tool which can be used to create and manage kubernetes clusters in AWS. It allows us to keep the cluster config as a file so that we know what are the configs that we use to spin up the clusters. If we use AWS console to create the EKS cluster, we need to click few more buttons to spin up the control plane, node groups, add-ons etc. However with eksctl it is just a one command and then eksctl will take care of everything. On the other hand, if we have multiple clusters such as dev, test, prod we can use pretty much the same cluster configs with minimal change. And with eksctl we can upgrade the cluster to the next version very easily.

Let’s see a sample cluster config to create a EKS cluster.

---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: cluster-1
region: eu-north-1

nodeGroups:
- name: ng-1
instanceType: m5.large
desiredCapacity: 1

Once you have created a cluster config file as above you can use following command to create the cluster.

eksctl create cluster -f cluster_config.yml

Eksctl supports to create the cluster in exisiting VPC too. You can refer to more details in the examples shown here in the eksctl official repo.

Even you can include add-ons creation to the same config as follows.

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: cluster-25
region: us-west-2
version: "1.23"

iam:
withOIDC: true

managedNodeGroups:
- name: mng1

addons:
- name: vpc-cni # no version is specified so it deploys the default version
attachPolicyARNs:
- arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
- name: coredns
version: latest # auto discovers the latest available
- name: kube-proxy
version: latest

--

--

No responses yet