Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

eksctl

Create and manage Amazon EKS (Kubernetes) clusters with one command or one YAML file.

Level
DevOps tool
Group
Infrastructure as Code and cloud
Needs root
No
Package
eksctl

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

create cluster [-f FILE]
Make a cluster (with node groups).
get cluster / nodegroup
List clusters / node groups.
create nodegroup / delete nodegroup
Add / remove node groups.
scale nodegroup
Change the number of nodes.
upgrade cluster / nodegroup
Upgrade Kubernetes.
utils write-kubeconfig
Write kubeconfig for a cluster.
create iamserviceaccount
IAM role for a Kubernetes service account (IRSA).
create addon
EKS add-ons (vpc-cni, coredns, ebs-csi).
delete cluster
Delete the cluster and its stacks.

Options 9

Most used

Options

-f, --config-file FILE
Use a ClusterConfig file.
--name / --region
Cluster name / AWS region.
--version 1.31
Kubernetes version.
--nodes / --nodes-min / --nodes-max
Node counts.
--node-type t3.large
EC2 instance type.
--managed
Managed node group (default).
--approve
Really make the change (for upgrade, iamserviceaccount).
--dry-run
Print the final config.
--profile NAME
AWS CLI profile.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1A quick test cluster

    eksctl create cluster --name lab --region eu-west-1 --nodes 2 --node-type t3.medium
  2. 2A 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.yaml
  3. 3Get the kubeconfig

    eksctl utils write-kubeconfig --cluster shop --region eu-west-1
    kubectl get nodes
  4. 4List clusters and node groups

    eksctl get cluster --region eu-west-1
    eksctl get nodegroup --cluster shop
  5. 5Scale a node group

    eksctl scale nodegroup --cluster shop --name apps --nodes 4
  6. 6Give 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 --approve
  7. 7Upgrade 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.32
  8. 8Add the EBS CSI driver

    eksctl create addon --cluster shop --name aws-ebs-csi-driver
  9. 9See the final config without making anything

    eksctl create cluster -f cluster.yaml --dry-run
  10. 10Delete the lab cluster (it costs money)

    eksctl delete cluster --name lab --region eu-west-1

Watch out

  • EKS clusters and NAT gateways cost money every hour; delete test clusters.
  • privateNetworking: true keeps nodes off the public internet.

Exit codes

0OK.
1Error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man eksctl