Skip to content

01 · Create the cluster

Goal: an EKS 1.37 cluster with Auto Mode enabled, in a new VPC with private subnets and a NAT gateway.

The config

cluster/cluster.yaml
# eksctl ClusterConfig: an EKS Auto Mode cluster for the custom node pools guide.
# Walkthrough: docs/01-create-cluster.md
#
#   eksctl create cluster -f cluster/cluster.yaml --profile "$AWS_PROFILE"
#
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: auto-mode-nodepools   # CHANGE ME if you changed $CLUSTER_NAME
  region: ap-southeast-2      # CHANGE ME to match $AWS_REGION
  version: "1.37"

vpc:
  # eksctl builds a new VPC with 3 public + 3 private subnets. Private subnets
  # reach the internet through NAT. One NAT gateway keeps a home lab cheap;
  # HighlyAvailable puts one in every AZ so losing an AZ doesn't cut egress.
  nat:
    gateway: Single

autoModeConfig:
  enabled: true
  # nodePools defaults to [general-purpose, system]. Keep them: step 02 reads
  # them before we build our own.

What each part does:

  • version: "1.37": on 1.37, new Auto Mode NodePools that don't set consolidationPolicy default to Balanced. We'll set it explicitly anyway in step 05.
  • autoModeConfig.enabled: true: eksctl turns on Auto Mode compute, block storage and load balancing, creates a node IAM role for the built-in pools, and enables the two built-in NodePools, general-purpose and system.
  • vpc.nat.gateway: Single: eksctl's default VPC has three public and three private subnets. Private subnets get outbound internet through NAT, which our nodes need because they'll have no public IPs. Single is already eksctl's default; it's written out so you know it's there. One NAT gateway is the cheap home-lab choice; HighlyAvailable puts one in each AZ so an AZ outage doesn't cut egress for the others.

Public subnets and Auto Mode

eksctl registers both public and private subnets with the cluster, and the eksctl Auto Mode docs note that if the cluster uses public subnets as cluster subnets, Auto Mode launches nodes into them. Current eksctl points the built-in default NodeClass at the private subnets only (you'll check this in step 02), but that's eksctl's choice, not yours. In step 04 we make it an explicit part of our own contract: private subnets only, and public IPs switched off.

Edit region: (and name: if you changed $CLUSTER_NAME) so the file matches your exports:

grep -nE "name:|region:" cluster/cluster.yaml
echo "$CLUSTER_NAME $AWS_REGION"

Create it

eksctl create cluster -f cluster/cluster.yaml --profile "$AWS_PROFILE"

Expect 10–20 minutes. eksctl creates CloudFormation stacks for the VPC and the control plane, then the Auto Mode node role, and installs the metrics-server add-on. It ends with:

[✔]  EKS cluster "auto-mode-nodepools" in "ap-southeast-2" region is ready

eksctl also writes a context into ~/.kube/config and switches to it. Because you passed --profile, the kubeconfig entry sets AWS_PROFILE for the authenticator, so kubectl authenticates with the same profile.

Verify

The cluster runs 1.37 with Auto Mode compute on:

aws eks describe-cluster --name "$CLUSTER_NAME" \
  --query '{version: cluster.version, status: cluster.status, compute: cluster.computeConfig}'

Look for "version": "1.37", "status": "ACTIVE", and a compute block with "enabled": true, "nodePools": ["general-purpose", "system"] and the nodeRoleArn eksctl created for the built-in pools.

kubectl talks to the cluster, and the Auto Mode objects exist:

kubectl config current-context
kubectl get nodepools
kubectl get nodeclass

You should see the two built-in NodePools, general-purpose and system, both referencing a NodeClass called default, and that default NodeClass itself.

Where did those nodes come from?

Auto Mode only launches nodes when pods need them. Right after creation kubectl get nodes may return nothing; a minute later you'll typically see two small nodes in the system pool. They're for the metrics-server pods eksctl installed, which tolerate the system pool's CriticalAddonsOnly taint. That's the built-in pools doing their job.

If kubectl can't reach the cluster, regenerate the kubeconfig entry:

aws eks update-kubeconfig --name "$CLUSTER_NAME" --profile "$AWS_PROFILE"

Next: 02 Read the defaults.