What it does
eksctl builds an EKS cluster with all the parts it needs — VPC, control plane, node groups, IAM — using CloudFormation stacks under the hood. A ClusterConfig YAML file keeps the cluster as code.
It also handles the day-2 work: node group upgrades, IAM roles for service accounts (IRSA) or pod identity, add-ons.
How to write it
eksctl create|get|upgrade|delete RESOURCE [OPTIONS]Main parts
Commands
createcluster[-f FILE]- Make a cluster (with node groups).
getcluster/nodegroup- List clusters / node groups.
createnodegroup/deletenodegroup- Add / remove node groups.
scalenodegroup- Change the number of nodes.
upgradecluster/nodegroup- Upgrade Kubernetes.
utilswrite-kubeconfig- Write kubeconfig for a cluster.
createiamserviceaccount- IAM role for a Kubernetes service account (IRSA).
createaddon- EKS add-ons (vpc-cni, coredns, ebs-csi).
deletecluster- Delete the cluster and its stacks.
Options 9
Most used
Options
Nothing matches this filter.
Examples 10
$ run as a normal user# run as root (or with sudo)
1A quick test cluster
eksctl create cluster --name lab --region eu-west-1 --nodes 2 --node-type t3.medium2A cluster from a file (cluster as code)
cat cluster.yaml apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: { name: shop, region: eu-west-1, version: "1.31" } iam: { withOIDC: true } managedNodeGroups: - name: apps instanceType: t3.large minSize: 2 maxSize: 6 privateNetworking: true eksctl create cluster -f cluster.yaml3Get the kubeconfig
eksctl utils write-kubeconfig --cluster shop --region eu-west-1 kubectl get nodes4List clusters and node groups
eksctl get cluster --region eu-west-1 eksctl get nodegroup --cluster shop5Scale a node group
eksctl scale nodegroup --cluster shop --name apps --nodes 46Give a pod an AWS role (no keys in the pod)
eksctl create iamserviceaccount --cluster shop --namespace shop --name s3-reader --attach-policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess --approve7Upgrade the control plane, then the nodes
eksctl upgrade cluster --name shop --version 1.32 --approve eksctl upgrade nodegroup --cluster shop --name apps --kubernetes-version 1.328Add the EBS CSI driver
eksctl create addon --cluster shop --name aws-ebs-csi-driver9See the final config without making anything
eksctl create cluster -f cluster.yaml --dry-run10Delete the lab cluster (it costs money)
eksctl delete cluster --name lab --region eu-west-1
Nothing matches this filter.
Watch out
- EKS clusters and NAT gateways cost money every hour; delete test clusters.
privateNetworking: truekeeps nodes off the public internet.
Exit codes
0 | OK. |
1 | Error. |