Narration: The EKS control plane runs in AWS's own account. It connects to your subnets through cross-account network interfaces.
Kubernetes Hour 7: Kubernetes on AWS (Amazon EKS)
- Understand EKS's division of responsibility. Choose between managed node groups, self-managed nodes, Fargate and EKS Auto Mode, and compare each item with AKS (control plane, nodes, networking, identity, upgrades).
- Understand how Amazon VPC CNI gives Pods real VPC IP addresses (ipamd, ENIs, warm pool). Calculate max pods per node, and diagnose and fix IP exhaustion (prefix delegation, secondary CIDR + custom networking).
- Use access entries to control who can run kubectl. Use EKS Pod Identity (or IRSA) to give Pods least-privilege access to S3 and Secrets Manager, with no long-lived keys stored anywhere.
- Use the AWS Load Balancer Controller (or the built-in capability in Auto Mode) to turn Ingress into an ALB and Service into an NLB. Understand IP target mode and subnet tags, and know the LBC's Gateway API support.
- For stateful workloads, choose EBS (gp3, single AZ) or EFS (RWX, multi-AZ). Use Secrets Store CSI or External Secrets to read from Secrets Manager.
- Use Karpenter (NodePool / EC2NodeClass,
karpenter.sh/v1) or Auto Mode for on-demand capacity, Spot, and node consolidation. Work through a cost optimization checklist. - Plan upgrades against the EKS version calendar (14 months of standard support + 12 months of extended support). Use cluster insights for pre-upgrade checks, and upgrade in this order: control plane → add-ons → nodes. Use one EKS troubleshooting tree for common failures, and clean up fully in dependency order.
1-hour timetable
| # | Time | Module | Core content | Animation / interaction | Lab |
|---|---|---|---|---|---|
| 0 | Before class | Warm-up and AWS setup | AWS CLI v2 + IAM Identity Center profile, eksctl 0.231.0, kubectl 1.37, region ca-central-1, permissions, cost, and cleanup commitment | — | eksctl creates eks-lab (Auto Mode, 1.36) |
| 1 | 00–07 | EKS architecture and choices | Managed control plane, node groups / self-managed / Fargate / Auto Mode, comparison with AKS, and the two ways eksctl can create a cluster | “Compute decision tool” | Read the CloudFormation stacks and cluster properties that eksctl generates |
| 2 | 07–15 | Networking: VPC CNI | Pods using VPC IPs, ENIs and IP limits, max pods formula, IP exhaustion, prefix delegation, custom networking, SG for Pods, kube-proxy, and comparison with Azure CNI Overlay | ipamd → ENI → warm pool → allocation; IP exhaustion causes ContainerCreating | Observe ENI / IP allocation and calculate max pods |
| 3 | 15–23 | Identity | access entries and aws-auth migration, access policies, EKS Pod Identity vs. IRSA, least-privilege access to S3 | Pod Identity credential flow | Pod can read only one S3 prefix |
| 4 | 23–31 | Traffic | LBC: Ingress → ALB, Service → NLB, IP targets, annotations, subnet tags; Gateway API support; built-in load balancing in Auto Mode | Ingress → ALB reconciliation process | shop's ALB Ingress |
| 5 | 31–38 | Storage and secrets | EBS CSI (gp3, AZ topology, WaitForFirstConsumer), EFS CSI (RWX), Secrets Store CSI + ASCP, External Secrets, and storage differences in Auto Mode | PVC → AZ binding of the EBS volume | shop db uses a gp3 PVC |
| 6 | 38–46 | Scaling and cost | Karpenter NodePool / EC2NodeClass, Auto Mode managed Karpenter, Spot interruptions, consolidation, comparison with Cluster Autoscaler, and a cost checklist | Karpenter provisioning + consolidation simulator | Load test that triggers scale-out and scale-in |
| 7 | 46–53 | Upgrades and operations | Version calendar (standard 1.34–1.37, extended 1.31–1.33), cluster insights, upgrade order, managed add-ons, CloudWatch Container Insights / AMP | Step-by-step animation of the upgrade pipeline | eks-lab 1.36 → 1.37 |
| 8 | 53–60 | EKS troubleshooting and cleanup | EKS-specific failure categories, interactive troubleshooting tree, cleanup in dependency order, and leftover-resource checks | Cleanup dependency-order animation + troubleshooting tree | Fault injection + full cleanup |
| — | After class | Cheat sheet · Capstone lab | eksctl cluster creation → shop → Pod Identity → ALB → EBS → scale-out load test → minor version upgrade → cleanup | Final quiz: 12 questions | Acceptance checklist: 12 items |
Knowledge Coverage Matrix
| Target skill | Module | Key commands | Lab | Production case |
|---|---|---|---|---|
| EKS compute options and cluster creation | M1 | eksctl create cluster --enable-auto-mode, eksctl create cluster -f | ✓ | ✓ |
| Pod networking and IP planning | M2 | kubectl set env ds aws-node, aws ec2 describe-network-interfaces, aws eks update-addon --configuration-values | ✓ | ✓ |
| Human access control (access entries) | M3 | aws eks create-access-entry, associate-access-policy, update-cluster-config --access-config | ✓ | ✓ |
| Workload access to AWS (Pod Identity / IRSA) | M3 | aws eks create-pod-identity-association, eksctl create iamserviceaccount | ✓ | ✓ |
| Exposing services with ALB / NLB | M4 | helm install aws-load-balancer-controller, IngressClass / IngressClassParams, loadBalancerClass | ✓ | ✓ |
| Block and file storage, and secrets | M5 | StorageClass ebs.csi.aws.com / ebs.csi.eks.amazonaws.com, efs.csi.aws.com, SecretProviderClass | ✓ | ✓ |
| Node autoscaling and Spot | M6 | kubectl get nodepools,nodeclaims, EC2NodeClass, helm upgrade --install karpenter | ✓ | ✓ |
| Version upgrades and add-on management | M7 | aws eks list-insights, eksctl upgrade cluster, aws eks update-addon, eksctl upgrade nodegroup | ✓ | ✓ |
| Observability | M7 | aws eks create-addon --addon-name amazon-cloudwatch-observability, AMP scraper | Reading | ✓ |
| EKS troubleshooting and cost cleanup | M8 | kubectl describe, aws ec2 describe-network-interfaces --filters, eksctl delete cluster --wait | ✓ | ✓ |
| End-to-end integration | Capstone lab | All | ✓ | ✓ |
Excluded from this hour
| Topic | Reason | Where to learn it |
|---|---|---|
Create EKS with Terraform (terraform-aws-modules/eks v21, compute_config for Auto Mode) | IaC is covered in another course. This hour uses eksctl to focus on the Kubernetes side. | Terraform Hour 4 · Module 6 |
| ECS / Fargate task definitions, ECR lifecycle policies | Covered in the Docker course | Docker Hour 4 (AWS) |
| EKS Hybrid Nodes, EKS Anywhere, Outposts, Windows nodes | Niche scenarios; beyond 1 hour | Matching chapters in the EKS User Guide |
| Service mesh (VPC Lattice, Istio), multi-cluster (Argo CD through EKS Capabilities, etc.) | Beyond 1 hour | EKS User Guide · Capabilities; Hour 6 GitOps module |
| IPv6 clusters, a full private-cluster walkthrough (VPC endpoint list for a cluster without NAT) | Principles and key points only | EKS Best Practices Guide · Networking |
How to use this course material
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · voice · video. Read Principles, Diagrams and Animations first, then do the Lab on eks-lab.
A module counts toward your progress when you score ≥ 70% on its quiz or click “Mark this module complete.” Progress is saved in this browser (key
k8s60-part7-progress-v1).Main track: the Auto Mode cluster
eks-lab (AWS manages the VPC CNI, load balancing, EBS and Karpenter). Optional branch: the managed node group cluster eks-mng, where you install the LBC, EBS CSI and Karpenter yourself and tune the VPC CNI. Both are billed by the hour, so delete them when you finish.Module 0 · Warm-up and AWS setup
- Completed hours 1–6: familiar with the shop application (namespace
shop: web =nginx:1.29-alpine, api =ghcr.io/stefanprodan/podinfo:6.17.0on port 9898, db =postgres:17), plus Helm, Kustomize and HPA. - Lab machine: the Ubuntu 24.04 Azure VM from hour 1 (or a local Linux / macOS / WSL2 machine), with Docker, kubectl and Helm 4 installed. The AWS labs do not depend on a kind cluster.
- An AWS account that can incur charges (a sandbox account under AWS Organizations is recommended), with IAM Identity Center (formerly AWS SSO) enabled.
Bridge from the previous hour: the same thing, and what it is called on AWS
| Hour 6 (Azure) | This hour (AWS) | One-line difference |
|---|---|---|
az login + subscription | aws sso login --profile + account / region | AWS switches accounts and roles with named configuration profiles |
Resource group rg-k8s-lab | CloudFormation stacks eksctl-eks-lab-* + tags | AWS has no one-step resource-group delete. Cleanup has to follow dependency order (M8). |
az aks create | eksctl create cluster (or aws eks create-cluster / Terraform) | eksctl creates the VPC, subnets, NAT and IAM roles together |
az aks get-credentials + kubelogin | aws eks update-kubeconfig (the exec plugin calls aws eks get-token) | Authentication uses IAM-signed tokens; authorization uses access entries + RBAC |
| AKS Automatic / NAP | EKS Auto Mode / Karpenter | Both platforms use the Karpenter approach to provision nodes |
| Workload Identity | EKS Pod Identity / IRSA | M3 detailed comparison |
Step 1: AWS CLI v2 + IAM Identity Center profile
curl -sSLo awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" unzip -q awscliv2.zip && sudo ./aws/install --update aws --version
aws configure sso --profile eks-lab # SSO session name: corp # SSO start URL: https://d-xxxxxxxxxx.awsapps.com/start # SSO region: ca-central-1 # Choose the account and permission set (for example AdministratorAccess or a custom EKSLabAdmin) # CLI default client Region: ca-central-1 # CLI default output format: json aws sso login --profile eks-lab export AWS_PROFILE=eks-lab AWS_REGION=ca-central-1 aws sts get-caller-identity
{
"UserId": "AROAXXXXXXXXXXXXXXXXX:alice@example.com",
"Account": "111122223333",
"Arn": "arn:aws:sts::111122223333:assumed-role/AWSReservedSSO_EKSLabAdmin_0123456789abcdef/alice@example.com"
}
arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/ca-central-1/AWSReservedSSO_EKSLabAdmin_…), not the session ARN. This is one of the most common M3 mistakes. When eksctl creates a cluster, it automatically grants cluster admin to the creator (bootstrapClusterCreatorAdminPermissions defaults to true).Step 2: install eksctl and kubectl 1.37
ARCH=amd64; PLATFORM=$(uname -s)_$ARCH curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz" tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz sudo install -m 0755 /tmp/eksctl /usr/local/bin/eksctl eksctl version
0.231.0
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -m 0755 kubectl /usr/local/bin/kubectl kubectl version --client helm version # Helm 4.3.x installed in hour 6
Auto Mode requires eksctl ≥ 0.195.0; this hour is written against v0.231.0 (2026-10-02). Create the cluster on 1.36 first. kubectl 1.37 and the 1.36 / 1.37 API servers are all within the ±1 version skew.
Step 3: required IAM permissions
| Service | Why it is needed | Minimum recommendation |
|---|---|---|
| EKS | Create the cluster, add-ons, access entries, Pod Identity associations | eks:* (lab account) |
| CloudFormation | eksctl uses CloudFormation stacks to create everything | cloudformation:* |
| EC2 / VPC | VPC, subnets, NAT, security groups, launch templates, ENIs | ec2:* |
| IAM | Cluster role, node role, Pod Identity roles, OIDC provider | iam:CreateRole/AttachRolePolicy/PassRole/CreateOpenIDConnectProvider… |
| ELB, Auto Scaling, SSM (reads AMI parameters), KMS, S3, Secrets Manager, SQS / EventBridge (Karpenter interruption queue) | Later modules | Read and write permissions for the matching services |
The eksctl docs include a reference "minimal IAM policy." In a lab account, the admin permission set is the simplest option. For production, use least privilege plus a permissions boundary.
Step 4: cost estimate and cleanup commitment (read this first)
| Resource | Estimate (ca-central-1, order of magnitude) | Notes |
|---|---|---|
| EKS control plane | 0.10 USD per cluster per hour (standard support) | Extended support costs more (public price about 0.60 USD per hour). Check the EKS pricing page. |
| Nodes (EC2) | m6i.large, about 0.1 USD per hour per node; 2–3 nodes | Auto Mode charges an Auto Mode management fee on top of EC2 costs (per instance type) |
| NAT Gateway | About 0.05 USD per hour + data processing fee per GB | eksctl creates one NAT gateway by default (vpc.nat.gateway: Single) |
| ALB / NLB (from M4 on) | About 0.02–0.03 USD per hour per load balancer + LCU/NLCU | Created by Ingress / Service. Not in the eksctl stack, so delete them from inside the cluster first |
| EBS gp3, EFS, Secrets Manager, CloudWatch logs | A few cents to 1 USD per day | An EBS volume with reclaimPolicy=Delete is deleted together with its PVC |
| Total | About 0.4–0.6 USD per hour, roughly 10–15 USD for a full day | Check the AWS Pricing Calculator |
type: LoadBalancer Services and Ingresses → ② delete the nodes created by Karpenter / Auto Mode (delete the workloads and NodePools) → ③ eksctl delete cluster --name eks-lab --wait → ④ check for leftover ENIs, load balancers, EBS volumes and CloudWatch log groups. Set up an AWS Budgets alert now (for example at 20 USD).aws budgets create-budget --account-id $(aws sts get-caller-identity --query Account --output text) \
--budget '{"BudgetName":"eks-lab","BudgetLimit":{"Amount":"20","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' \
--notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"you@example.com"}]}]'
Step 5: create this hour's main cluster, eks-lab (Auto Mode, intentionally on 1.36)
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-lab
region: ca-central-1
version: "1.36" # Upgrade to 1.37 in module 7
tags:
project: k8s-course
owner: alice
accessConfig:
authenticationMode: API # Access entries only (Auto Mode requires access entries)
autoModeConfig:
enabled: true # eksctl sets computeConfig / elasticLoadBalancing / blockStorage = true
# If nodePools is omitted, the defaults are [general-purpose, system]; eksctl creates the node IAM role automatically
vpc:
nat:
gateway: Single # Single NAT to save cost in labs; use HighlyAvailable (one per AZ) in production
cloudWatch:
clusterLogging:
enableTypes: ["audit", "authenticator"] # Control plane logs (billed by usage; can be turned off if not needed)
eksctl create cluster -f eks-lab.yaml # about 15–20 minutes
kubectl config current-context
kubectl get nodes # Auto Mode: may show 0 nodes when there are no workloads
kubectl get nodepools # general-purpose, system
aws eks describe-cluster --name eks-lab --query "cluster.{v:version,auth:accessConfig.authenticationMode,compute:computeConfig.enabled,lb:kubernetesNetworkConfig.elasticLoadBalancing.enabled,ebs:storageConfig.blockStorage.enabled}"
2026-11-15 10:02:11 [ℹ] eksctl version 0.231.0
2026-11-15 10:02:11 [ℹ] using region ca-central-1
2026-11-15 10:02:12 [ℹ] subnets for ca-central-1a - public:192.168.0.0/19 private:192.168.96.0/19
2026-11-15 10:02:12 [ℹ] subnets for ca-central-1b - public:192.168.32.0/19 private:192.168.128.0/19
2026-11-15 10:02:12 [ℹ] subnets for ca-central-1d - public:192.168.64.0/19 private:192.168.160.0/19
...
2026-11-15 10:17:40 [✔] EKS cluster "eks-lab" in "ca-central-1" region is ready
NAME NODECLASS NODES READY AGE
general-purpose default 0 True 3m
system default 0 True 3m
{ "v": "1.36", "auth": "API", "compute": true, "lb": true, "ebs": true }
The three Availability Zones in ca-central-1 are named ca-central-1a / 1b / 1d (there is no 1c). This is a common mistake when writing topology.kubernetes.io/zone affinity rules.
Step 6 (optional branch): managed node group cluster eks-mng
If you want to install the LBC, EBS CSI and Karpenter yourself and tune the VPC CNI, create a "traditional" cluster as well (do not run it for long at the same time as eks-lab):
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-mng
region: ca-central-1
version: "1.37"
accessConfig:
authenticationMode: API
iam:
withOIDC: true # Prepare the OIDC provider for the IRSA comparison lab
addons:
- name: vpc-cni
- name: coredns
- name: kube-proxy
- name: eks-pod-identity-agent
- name: aws-ebs-csi-driver
useDefaultPodIdentityAssociations: true
managedNodeGroups:
- name: ng-general
instanceType: m6i.large
minSize: 2
maxSize: 4
desiredCapacity: 2
privateNetworking: true
labels: { role: general }
vpc:
nat: { gateway: Single }
eksctl create cluster -f eks-mng.yaml eksctl get nodegroup --cluster eks-mng kubectl get nodes -L eks.amazonaws.com/nodegroup,topology.kubernetes.io/zone
Module 1 · EKS architecture and choices
- Explain what EKS manages (the control plane, etcd, high availability across 3 AZs) and what you manage (the data plane, networking, identity, add-on versions).
- Compare the responsibility boundaries, scaling methods, upgrade methods and limits of managed node groups, self-managed nodes, Fargate and EKS Auto Mode.
- Use eksctl to create a cluster in both Auto Mode and managed node group modes. Read the CloudFormation stacks and IAM roles it creates.
- Map AKS concepts to EKS one by one (control plane, nodes, networking, identity, upgrades).
What: what EKS is
Amazon EKS is the AWS-managed Kubernetes control plane. For each cluster, AWS runs at least 2 kube-apiserver instances and 3 etcd nodes in its own account, spread across 3 Availability Zones in the region. It replaces unhealthy instances, patches them and backs up etcd automatically. The control plane connects to the subnets you specify in your VPC through cross-account ENIs (X-ENI), so the API server can reach kubelets (kubectl logs/exec) and webhooks. You cannot see or log in to the control plane nodes.
Why: why the choice comes down to where your nodes come from
The control plane is the same in every case. The difference is the data plane. EKS offers four compute options, and the responsibility boundary moves further toward AWS in this order:
| Option | Who creates and patches the nodes | Scaling | Upgrades | Best for | Limits |
|---|---|---|---|---|---|
| Self-managed nodes | You: your own ASG + launch template + EKS-optimized AMI | You install Cluster Autoscaler or Karpenter | You roll the replacements yourself | Extreme customization (custom AMIs, special kernels) | Highest operations burden; the node IAM role must be added manually as an access entry (type EC2_LINUX) |
| Managed node groups | EKS creates the ASG for you; you choose the AMI type and instance types | ASG + Cluster Autoscaler or Karpenter | eksctl upgrade nodegroup: EKS rolls the nodes using surge and respects PDBs | Most "traditional" clusters | Instance type choice within a node group is limited; scaling depends on the ASG |
| Fargate | AWS: one micro VM per Pod | Billed per Pod, no nodes to manage | Deleting and recreating a Pod gets a fresh kubelet | A few isolated workloads and batch jobs | No DaemonSets, privileged containers, hostNetwork, EBS volumes or GPUs; slower cold start per Pod |
| EKS Auto Mode | AWS: managed Karpenter chooses EC2 instances; nodes run AWS-maintained Bottlerocket-based images with a read-only root filesystem, and SSH is not available | Built-in Karpenter (NodePool / NodeClass), provisions for pending Pods | After a control plane upgrade, nodes are replaced automatically under the NodePool disruption budget; maximum node lifetime is 21 days | Recommended default for new clusters | Nodes cannot be logged into or given custom AMIs; extra Auto Mode management fee; some LBC annotations and CSI parameters are not supported |
How: which "add-ons" Auto Mode turns into platform capabilities
When Auto Mode is enabled, eksctl calls the EKS API to set computeConfig.enabled=true, kubernetesNetworkConfig.elasticLoadBalancing.enabled=true and storageConfig.blockStorage.enabled=true. These components no longer run as Pods in your cluster. AWS manages them:
- Compute: Karpenter (the NodePool is still the
karpenter.sh/v1CRD; the NodeClass iseks.amazonaws.com/v1). - Networking: VPC CNI, kube-proxy and CoreDNS (they run on the nodes, with versions managed by AWS).
- Load balancing: the same capability as the AWS Load Balancer Controller (IngressClass controller
eks.amazonaws.com/alb, ServiceloadBalancerClass: eks.amazonaws.com/nlb). - Storage: EBS CSI (provisioner
ebs.csi.eks.amazonaws.com; note that it differs from the open-source driver'sebs.csi.aws.com). - Identity: EKS Pod Identity Agent is built in. GPU drivers and node monitoring agents are built in too.
When: how to choose
- New cluster, and the team wants to manage fewer nodes → Auto Mode (the same positioning as AKS Automatic).
- You need custom AMIs, SSH to nodes, specific DaemonSets (for example, a security agent that requires host privileges), or fine-grained VPC CNI tuning → managed node groups + self-installed Karpenter.
- A small number of strongly isolated workloads that don't need nodes → Fargate profiles (can be mixed with other options).
- Use self-managed nodes only when neither of the first two options meets your requirements.
Comparison with AKS
| Dimension | AKS (hour 6) | EKS (this hour) |
|---|---|---|
| Control plane | Free (no SLA) / Standard (99.95% with availability zones) / Premium (+LTS) | One tier only: 0.10 USD per cluster per hour (standard support), SLA 99.95% (check the EKS SLA page); extended support costs more |
| Version support | Community support for about 12 months + LTS for 24 months (Premium) | 14 months of standard support + 12 months of extended support (on by default, extra charge) |
| Nodes | VMSS node pools (System / User); NAP (Karpenter); Automatic | Managed node groups (ASG); self-managed; Fargate; Karpenter; Auto Mode |
| Pod networking | Azure CNI Overlay (Pod CIDR is separate and does not use up the VNet) + Cilium | VPC CNI: Pods use real VPC subnet IPs by default (M2) |
| Human identity | Entra ID + Azure RBAC / K8s RBAC | IAM (Identity Center) → access entries + access policies / K8s RBAC groups |
| Workload identity | Workload Identity (OIDC federation) | EKS Pod Identity (recommended) or IRSA (OIDC federation) |
| Inbound | App Routing add-on (Gateway API), AGC | AWS LBC / Auto Mode: Ingress → ALB, Service → NLB; the LBC supports Gateway API |
| Upgrades | Automatic upgrade channel + node OS channel + maintenance window | Control plane upgrades are triggered manually (no automatic upgrade channel; forced upgrade when extended support ends). Node groups are upgraded manually, or automatically in Auto Mode. A minor version upgrade can be rolled back within 7 days. |
| Stopping the cluster to save money | az aks stop | There is no "stop cluster" option. You can scale nodes to 0, but the control plane is still billed. |
kubectl debug node/ (restricted) or a NodeDiagnostic to collect logs.EKS responsibility boundary and account boundary
What eksctl create cluster does behind the scenes
Step-by-step animation: from eksctl create cluster to the first running Pod
Switch between the "Auto Mode" and "managed node group" methods, and watch how the nodes are created and join the cluster.
Command table
| Command | Purpose | Key parameters |
|---|---|---|
eksctl create cluster --name eks-lab --region ca-central-1 --enable-auto-mode | Create an Auto Mode cluster with one command | --version; default NodePools general-purpose + system |
eksctl create cluster -f cluster.yaml | Create the cluster declaratively (recommended; keep the config in Git) | --dry-run prints the complete config with defaults filled in |
eksctl get cluster / nodegroup / addon | View | -o yaml |
aws eks describe-cluster --name X | Cluster properties (version, endpoint, OIDC, accessConfig, computeConfig) | --query |
aws eks update-kubeconfig --name X --alias X | Write to kubeconfig | --role-arn (access as another role) |
eksctl update auto-mode-config -f cluster.yaml | Turn Auto Mode on or off for an existing cluster | - |
eksctl create fargateprofile --cluster X --name fp-batch --namespace batch | Fargate profile: Pods that match the namespace and labels run on Fargate | --labels |
aws cloudformation list-stacks --query "StackSummaries[?starts_with(StackName,'eksctl-eks-lab')]" | View the stacks eksctl created | Troubleshoot creation and deletion failures |
1. Run a dry run first to see which defaults eksctl fills in
eksctl create cluster -f eks-lab.yaml --dry-run | head -60
apiVersion: eksctl.io/v1alpha5
autoModeConfig:
enabled: true
nodePools:
- general-purpose
- system
availabilityZones:
- ca-central-1a
- ca-central-1b
- ca-central-1d
kind: ClusterConfig
kubernetesNetworkConfig:
ipFamily: IPv4
metadata:
name: eks-lab
region: ca-central-1
version: "1.36"
vpc:
cidr: 192.168.0.0/16
clusterEndpoints:
privateAccess: false
publicAccess: true
nat:
gateway: Single
...
How to verify: confirm that vpc.cidr does not conflict with your company network (it cannot be changed later if you connect via TGW or VPN). Check clusterEndpoints: by default the public endpoint is open to the whole internet, so in production set publicAccessCIDRs or use a private endpoint only. Common mistake: an AZ in the region does not support the chosen instance type → specify availabilityZones. Production use: the dry-run output is an auditable "complete config." Commit it to Git for review.
2. Check the cluster's key properties (the counterpart of az aks show in hour 6)
aws eks describe-cluster --name eks-lab --query "cluster.{version:version,platform:platformVersion,endpoint:endpoint,public:resourcesVpcConfig.endpointPublicAccess,private:resourcesVpcConfig.endpointPrivateAccess,cidrs:resourcesVpcConfig.publicAccessCidrs,oidc:identity.oidc.issuer,auth:accessConfig.authenticationMode,upgradePolicy:upgradePolicy.supportType,auto:computeConfig}" --output json
{
"version": "1.36",
"platform": "eks.8",
"endpoint": "https://0123456789ABCDEF0123456789ABCDEF.gr7.ca-central-1.eks.amazonaws.com",
"public": true,
"private": false,
"cidrs": ["0.0.0.0/0"],
"oidc": "https://oidc.eks.ca-central-1.amazonaws.com/id/0123456789ABCDEF0123456789ABCDEF",
"auth": "API",
"upgradePolicy": "EXTENDED",
"auto": { "enabled": true, "nodePools": ["general-purpose", "system"], "nodeRoleArn": "arn:aws:iam::111122223333:role/eksctl-eks-lab-cluster-AutoModeNodeRole-XXXX" }
}
upgradePolicy.supportType defaults to EXTENDED. Once a version passes standard support, the cluster moves to extended support automatically, and the price goes up. Set it to STANDARD to be upgraded automatically when standard support ends. platformVersion (eks.N) is EKS's platform patch number within the same minor version; AWS advances it automatically.
3. Restrict the sources that can reach the public endpoint (required in production)
MYIP=$(curl -s https://checkip.amazonaws.com) aws eks update-cluster-config --name eks-lab \ --resources-vpc-config endpointPublicAccess=true,endpointPrivateAccess=true,publicAccessCidrs="$MYIP/32" aws eks wait cluster-active --name eks-lab
Common mistake: once only the private endpoint is enabled, CI systems and laptops outside the VPC cannot reach the cluster. You need a VPN, a jump host, or a self-hosted runner inside the VPC (the same as AKS private clusters). After you turn on endpointPrivateAccess, traffic from the nodes to the API server stays inside the VPC.
4. Fargate profile (mixed-use example)
eksctl create fargateprofile --cluster eks-mng --name fp-batch --namespace batch --labels compute=fargate kubectl -n batch run once --image=busybox:1.37 --labels=compute=fargate --restart=Never -- sh -c 'echo hi; sleep 30' kubectl -n batch get pod once -o wide # NODE column shows fargate-ip-192-168-xx-xx…
Lab 1: read eks-lab (about 10 min, no extra cost)
aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE \ --query "StackSummaries[?starts_with(StackName,'eksctl-eks-lab')].StackName" --output table aws cloudformation describe-stack-resources --stack-name eksctl-eks-lab-cluster \ --query "StackResources[].[ResourceType,LogicalResourceId]" --output table | head -40
| eksctl-eks-lab-cluster | | AWS::EC2::VPC | VPC | | AWS::EC2::NatGateway | NATGateway | | AWS::EC2::Subnet | SubnetPrivateCACENTRAL1A | | AWS::IAM::Role | ServiceRole | | AWS::IAM::Role | AutoModeNodeRole | | AWS::EKS::Cluster | ControlPlane | ...
kubectl get nodepools general-purpose -o yaml | sed -n '/^spec:/,$p' kubectl get nodeclasses.eks.amazonaws.com default -o yaml | sed -n '/^spec:/,/^status:/p'
spec:
disruption:
budgets:
- nodes: 10%
consolidateAfter: 30s
consolidationPolicy: WhenEmptyOrUnderutilized
template:
spec:
expireAfter: 336h
nodeClassRef:
group: eks.amazonaws.com
kind: NodeClass
name: default
requirements:
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
- key: eks.amazonaws.com/instance-category
operator: In
values: ["c", "m", "r"]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
...
Field values depend on what your cluster actually outputs (AWS may change the built-in NodePool defaults). Note that the instance-selection label prefix in Auto Mode is eks.amazonaws.com/, while self-installed Karpenter uses karpenter.k8s.aws/.
kubectl create ns shop kubectl -n shop create deploy api --image=ghcr.io/stefanprodan/podinfo:6.17.0 --port=9898 kubectl -n shop set resources deploy/api --requests=cpu=250m,memory=128Mi kubectl get nodeclaims -w # In about 30–60 seconds, NodeClaim → Launched → Registered → Initialized kubectl get nodes -L eks.amazonaws.com/compute-type,node.kubernetes.io/instance-type,topology.kubernetes.io/zone
NAME TYPE CAPACITY ZONE NODE READY AGE general-purpose-7xk2p c6a.large on-demand ca-central-1b i-0abc… True 52s NAME STATUS ROLES AGE VERSION COMPUTE-TYPE INSTANCE-TYPE ZONE i-0abc1234def567890 Ready <none> 40s v1.36.x-eks-xxxxxxx auto c6a.large ca-central-1b
kubectl -n shop get pod -o wide output, the Pod IPs fall in the private subnet range (192.168.96.0/19, for example). This is the "Pods use real VPC IPs" behavior that M2 covers.kubectl -n shop scale deploy/api --replicas=0. Auto Mode reclaims empty nodes after consolidateAfter.Case 1: a platform team moves from "managed node groups + CA" to Auto Mode
Problem: 12 node groups (split by instance type), and every EKS upgrade takes two days of rotating node groups and add-ons. Approach: create a new Auto Mode cluster → rebuild the workloads with GitOps → change the StorageClass from ebs.csi.aws.com to ebs.csi.eks.amazonaws.com (existing volumes are migrated through snapshots) → change Ingress to IngressClass eks.amazonaws.com/alb + IngressClassParams. Limitation: the security team's host agent needs to write to the host filesystem. Auto Mode does not support this because its root filesystem is read-only, so they switched to AWS-managed GuardDuty Runtime Monitoring.
Case 2: batch jobs on Fargate, online services on managed node groups
The nightly ETL job runs 200 Pods for 20 minutes each. Node group scaling is slow and requires reserved capacity. They switched to a Fargate profile for the batch namespace: billed per Pod, with no node operations. Limitations: Fargate does not support DaemonSets, so logs go through the built-in Fargate Fluent Bit (configured by a ConfigMap in the aws-observability namespace). EBS is not supported, so temporary data uses ephemeral storage.
Case 3: compliance requires "nodes must use the company's hardened AMI"
Auto Mode does not support custom AMIs. Approach: managed node groups + a custom launch template (the company AMI, based on EKS-optimized AL2023 and bootstrapped with nodeadm), then self-install Karpenter (the EC2NodeClass amiSelectorTerms points to the company AMI). Trade-off: the platform team owns the monthly AMI rebuilds and rotation.
Common mistakes and fixes
Error: … AlreadyExistsException: Stack [eksctl-eks-lab-cluster] already exists
Cause: the previous creation failed or the deletion did not finish, leaving stacks behind.
aws cloudformation describe-stacks --stack-name eksctl-eks-lab-cluster --query "Stacks[0].StackStatus" aws cloudformation describe-stack-events --stack-name eksctl-eks-lab-cluster --max-items 15 \ --query "StackEvents[?contains(ResourceStatus,'FAILED')].[LogicalResourceId,ResourceStatusReason]" --output table eksctl delete cluster --name eks-lab --wait # Or delete the stack in the console, then retry
UnsupportedAvailabilityZoneException: Cannot create cluster because ca-central-1x … does not have sufficient capacity
Cause: an AZ does not support the EKS control plane ENI, or it has insufficient capacity (this varies by region).
Fix: explicitly specify availabilityZones: [ca-central-1a, ca-central-1b, ca-central-1d] in the ClusterConfig, or replace the AZ that is reporting the error.
Auto Mode: Pods stay Pending and kubectl get nodeclaims is empty
Cause: the Pod's nodeSelector or affinity requirements do not overlap with the requirements of any NodePool (for example, it requires arm64, but general-purpose allows only amd64). Or a NodePool has reached its limits, or the Pod has a constraint that Auto Mode does not support.
kubectl describe pod -n shop -l app=api | sed -n '/Events/,$p' kubectl get nodepools -o custom-columns=N:.metadata.name,READY:.status.conditions[-1].status kubectl get events -A --field-selector source=karpenter --sort-by=.lastTimestamp | tail
The events usually include a message like incompatible with nodepool "general-purpose", … requirements ….
error: You must be logged in to the server (Unauthorized) (right after creating the cluster, on a different machine)
Cause: the AWS identity on the new machine is not the cluster creator, and no access entry has been created for it yet (M3).
aws sts get-caller-identity aws eks list-access-entries --cluster-name eks-lab
1. Write a ClusterConfig: cluster name eks-demo, version 1.37, region ca-central-1, Auto Mode enabled but without creating the default NodePools, and access entries only.
Reference answer
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata: { name: eks-demo, region: ca-central-1, version: "1.37" }
accessConfig: { authenticationMode: API }
autoModeConfig:
enabled: true
nodePools: [] # Do not create general-purpose / system; write your own NodePool later2. Use one aws CLI command to query the cluster's upgrade policy (standard or extended support), and change it to STANDARD.
Reference answer
aws eks describe-cluster --name eks-lab --query cluster.upgradePolicy aws eks update-cluster-config --name eks-lab --upgrade-policy supportType=STANDARD
Scenario analysis: The team requires: ① nodes must run the company EDR agent (a privileged host DaemonSet); ② as few nodes to manage as possible; ③ 300 short jobs every night. Give a combination of compute options.
Reference answer
① rules out Auto Mode for the online services (read-only root filesystem and restricted privileged capabilities; confirm whether the EDR agent supports it) and rules out Fargate (no DaemonSets). Recommended: managed node groups for system workloads + self-installed Karpenter (on-demand, Spot and consolidation, which reduces node group management) for the online services and the EDR agent. The nightly short jobs can use a Karpenter Spot NodePool, or a Fargate profile if the EDR compliance policy allows it. If the EDR vendor supports Auto Mode (or you switch to GuardDuty Runtime Monitoring), moving everything to Auto Mode gives the least operations work.
Video lectures (title and channel verified via YouTube oEmbed; Verified on 2026-11-15)
Official docs
Video storyboard script
This course material cannot generate video or MP3 files directly, so it provides a storyboard and narration script.
Narration: The EKS control plane runs in AWS's own account. It connects to your subnets through cross-account network interfaces.
Narration: The difference is all in the data plane. The further right you go, the more AWS does for you and the less you can customize.
Narration: With Auto Mode, a new cluster may have no nodes at all. The node is created on demand when the first Pod appears.
Narration: Remember three differences. The EKS control plane is billed by the hour. Pods use real VPC addresses by default. You trigger control plane upgrades yourself.
Module 2 · Networking: Amazon VPC CNI and IP planning
- Explain the two components of VPC CNI (the CNI binary and the ipamd /
aws-nodeDaemonSet), and how ENIs, secondary IPs and the warm pool relate to each other. - Use the formula
ENIs × (IPs per ENI − 1) + 2to calculate max pods, and understand how Pod density and subnet size together limit cluster size. - Diagnose IP exhaustion (Pods stuck in ContainerCreating,
failed to assign an IP address to container) and choose a fix: prefix delegation, tuning the WARM_* parameters, or a secondary CIDR with custom networking. - Understand Security Groups for Pods, the VPC CNI's native NetworkPolicy and kube-proxy modes, and compare them with Azure CNI Overlay.
What: what VPC CNI does
VPC CNI (amazon-vpc-cni-k8s) gives each Pod a real private IP from the VPC subnet it runs in. It has two parts:
- CNI binary (
/opt/cni/bin/aws-cni): kubelet calls it through CRI when it creates the Pod sandbox. It creates the veth and sets up routes and iptables rules. - ipamd (runs in the
aws-nodeDaemonSet with hostNetwork): the node-level IP address management daemon. It calls the EC2 API (CreateNetworkInterface,AttachNetworkInterface,AssignPrivateIpAddresses) to attach ENIs to the node and request secondary IPs. It also keeps a warm pool, so Pods don't have to wait for the EC2 API when they start.
Why: why AWS chose real IPs
The Pod IP is the VPC IP, so there is no overlay encapsulation overhead. ALB and NLB can send traffic straight to Pods as IP targets (M4), and VPC flow logs, security groups, VPC peering and TGW can see and route to Pods directly. The cost is that each Pod takes one address from the subnet, and each instance type has a fixed number of ENIs, and a fixed number of IPs per ENI.
How: where the IPs come from
- When a node starts, it has only the primary ENI. The primary IP is used by the node itself and by hostNetwork Pods.
- ipamd uses
WARM_ENI_TARGET(default 1) to attach another ENI in advance and fill it with secondary IPs. This forms the warm pool. - kubelet creates a Pod → calls aws-cni ADD → aws-cni asks the local ipamd for an IP over gRPC → ipamd takes one from the pool → the CNI creates the veth and sets up routes.
- When the IPs in the pool drop to the threshold, ipamd attaches another ENI. This continues until the instance type's ENI limit is reached. After that, new Pods cannot get IPs.
- After a Pod is deleted, its IP goes into a 30-second cooldown cache (so each node's kube-proxy rules can update), and then returns to the pool.
Max pods formula (secondary IP mode): ENIs × (IPs per ENI − 1) + 2. The "−1" is because each ENI's primary IP cannot be given to a Pod. The "+2" covers the two hostNetwork Pods, aws-node and kube-proxy. Example: m5.large has 3 ENIs with 10 IPs each → 3 × 9 + 2 = 29; c5.large is also 29. In other words, a 2-vCPU node runs at most 29 Pods, no matter how idle its CPU is.
When: three ways to expand IP capacity
| Method | How it works | What it solves | Cost / limits |
|---|---|---|---|
Prefix delegation (ENABLE_PREFIX_DELEGATION=true) | Each ENI slot gets a /28 prefix (16 IPs) instead of a single IP | Pod density (recommended max pods 110 on m5.large), fewer EC2 API calls | Nitro instances only; may not find a contiguous /28 in a fragmented subnet; IPs are consumed in blocks of 16, so small subnets run out faster |
Secondary CIDR + custom networking (AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG=true + ENIConfig) | Add a secondary CIDR to the VPC (commonly a range inside 100.64.0.0/10), and build the Pods' ENIs in "Pod subnets" | The primary VPC address space is not large enough (connectivity to the company network, and it cannot be expanded) | The primary ENI no longer serves Pods, so max pods drops. You must write an ENIConfig per AZ, and nodes must be recreated |
Tune WARM_* (WARM_IP_TARGET / MINIMUM_IP_TARGET) | Reduces the idle IPs each node keeps in the pool | Large subnets get consumed by the warm pool | Pod startup may wait on the EC2 API; risk of EC2 API throttling |
| IPv6 cluster | Pods use IPv6, where the address space is practically unlimited | A fundamental fix | Can only be chosen when the cluster is created; the whole path must support IPv6 |
Comparison with Azure CNI Overlay
| Dimension | EKS VPC CNI (default) | Azure CNI Overlay (hour 6) |
|---|---|---|
| Source of Pod IPs | Real VPC subnet IPs | Separate Pod CIDR (default 10.244.0.0/16), does not use up the VNet |
| Can Pods be reached directly inside the VPC / VNet? | Yes (subject to security groups) | No; SNAT to the node IP when leaving the cluster |
| Pod density limit | ENIs × IPs limit (can be relaxed in prefix mode) | Default 250 per node, unrelated to the VNet |
| IP exhaustion risk | High; subnets must be planned | Low |
| Load balancer direct to Pods | ALB/NLB IP target mode | Through the node (or AGC, etc.) |
| NetworkPolicy | VPC CNI native (eBPF, enableNetworkPolicy: "true"), or Calico / Cilium | Cilium data plane |
| Pod-level security groups | Security Groups for Pods (branch ENI) | No direct equivalent (use NSGs + NetworkPolicy) |
Security Groups for Pods and kube-proxy
Security Groups for Pods: after you set ENABLE_POD_ENI=true on aws-node, the VPC Resource Controller attaches a trunk ENI to Nitro nodes. Pods that match a SecurityGroupPolicy (vpcresources.k8s.aws/v1beta1) get their own branch ENI with the specified security groups. This lets you use security groups to control things like "only the api Pods can connect to RDS." The cluster IAM role must have AmazonEKSVPCResourceController attached. Each instance type supports a limited number of branch ENIs. Check the official docs for support on Auto Mode and Fargate.
kube-proxy: on managed node groups it runs as the kube-proxy managed add-on, using iptables mode by default. ipvs has been marked deprecated in upstream 1.37 (nftables is recommended). For EKS add-on support of nftables mode, check the EKS docs. In Auto Mode, kube-proxy is managed by AWS.
Allocatable: pods in kubectl describe node. ② "A /24 subnet has 251 addresses, enough for 50 Pods." By default the warm pool reserves a full ENI's worth of IPs on each node, so 3 nodes may consume 60+ addresses first. ③ "After enabling prefix delegation, existing nodes take effect immediately." You need to replace the nodes (and adjust max pods) for it to take full effect. ④ "VPC CNI does not support NetworkPolicy." It has supported it natively since v1.14; you need to enable it in the add-on configuration.ENIs, secondary IPs and the warm pool on a node (m5.large, secondary IP mode)
Secondary CIDR + custom networking
Core animation: how VPC CNI assigns IPs to Pods (and what happens when IPs run out)
A m5.large node (3 ENIs × 10 IPs each, secondary-IP mode, WARM_ENI_TARGET=1). Click “Next step” to run the steps one at a time. “Create Pods continuously” keeps adding Pods until the addresses run out. You can switch to prefix delegation to compare.
Command table
| Command | Purpose | Key parameters |
|---|---|---|
kubectl -n kube-system get ds aws-node -o yaml | Check the VPC CNI version and environment variables | Managed node group clusters only; not present in Auto Mode |
aws eks describe-addon --cluster-name X --addon-name vpc-cni | Managed add-on version and configuration | --query addon.configurationValues |
aws eks update-addon … --configuration-values '{"env":{…}}' | Change the CNI environment variables through the managed add-on (recommended; avoids being overwritten by drift correction) | --resolve-conflicts PRESERVE|OVERWRITE |
aws ec2 describe-instance-types --instance-types m5.large --query "InstanceTypes[].NetworkInfo" | Instance ENI and IP limits | MaximumNetworkInterfaces, Ipv4AddressesPerInterface |
aws ec2 describe-subnets --query "Subnets[].[SubnetId,AvailabilityZone,AvailableIpAddressCount]" | Remaining subnet addresses | First step when troubleshooting IP exhaustion |
aws ec2 describe-network-interfaces --filters Name=attachment.instance-id,Values=i-… | ENIs and secondary IPs on the node | --query "NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress" |
kubectl get node N -o jsonpath='{.status.allocatable.pods}' | Node max pods | - |
kubectl apply -f securitygrouppolicy.yaml | Pod-level security groups | podSelector, securityGroups.groupIds |
1. Calculate max pods
aws ec2 describe-instance-types --instance-types m5.large c6i.xlarge \ --query "InstanceTypes[].[InstanceType,NetworkInfo.MaximumNetworkInterfaces,NetworkInfo.Ipv4AddressesPerInterface]" --output table kubectl get nodes -o custom-columns=NAME:.metadata.name,TYPE:.metadata.labels.node\\.kubernetes\\.io/instance-type,MAXPODS:.status.allocatable.pods
| c6i.xlarge | 4 | 15 | | m5.large | 3 | 10 | NAME TYPE MAXPODS ip-192-168-101-23.ca-central-1.compute.internal m5.large 29
m5.large: 3 × (10 − 1) + 2 = 29; c6i.xlarge: 4 × 14 + 2 = 58. AWS provides max-pods-calculator.sh in the VPC CNI repository. It combines the CNI version and prefix mode to give a recommended value (in prefix mode, instances with vCPU < 30 get a recommended value of 110).
2. Check the node's ENIs and IPs (to understand the warm pool)
NODE=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
IID=$(kubectl get node $NODE -o jsonpath='{.spec.providerID}' | awk -F/ '{print $NF}')
aws ec2 describe-network-interfaces --filters Name=attachment.instance-id,Values=$IID \
--query "NetworkInterfaces[].{eni:NetworkInterfaceId,idx:Attachment.DeviceIndex,ips:length(PrivateIpAddresses),prefixes:length(Ipv4Prefixes || \`[]\`)}" --output table
kubectl get pods -A --field-selector spec.nodeName=$NODE -o jsonpath='{range .items[?(@.spec.hostNetwork!=true)]}{.metadata.name}{"\n"}{end}' | wc -l # Number of Pods using VPC IPs (excluding hostNetwork)
| eni | idx | ips | prefixes | | eni-0aa… | 0 | 10 | 0 | | eni-0bb… | 1 | 10 | 0 | 4
Reading the output: Only 4 Pods use VPC IPs, but they occupy 20 addresses (10 on each of 2 ENIs). The second ENI is the warm ENI from WARM_ENI_TARGET=1.
3. Enable prefix delegation and NetworkPolicy through the managed add-on (eks-mng)
aws eks update-addon --cluster-name eks-mng --addon-name vpc-cni \
--configuration-values '{"env":{"ENABLE_PREFIX_DELEGATION":"true","WARM_PREFIX_TARGET":"1"},"enableNetworkPolicy":"true"}' \
--resolve-conflicts PRESERVE
aws eks wait addon-active --cluster-name eks-mng --addon-name vpc-cni
kubectl -n kube-system get ds aws-node -o jsonpath='{.spec.template.spec.containers[0].env}' | tr ',' '\n' | grep -E "PREFIX|WARM"
# Raise the node max pods to match: with AL2023 managed node groups, set maxPods in the nodeadm NodeConfig in the launch template, or replace the node group
eksctl create nodegroup --cluster eks-mng --name ng-prefix --node-type m6i.large --nodes 2 --max-pods-per-node 110
Common mistake: Running kubectl set env ds aws-node to change fields that EKS manages in the managed add-on can be reverted by EKS drift correction, which runs every 15 minutes. WARM_* and mode variables are not managed, but setting everything through --configuration-values is easier to audit. Production use: Pod-dense clusters (many small Pods) almost always enable prefix delegation.
4. Custom networking (ENIConfig)
# 1) Add a secondary CIDR to the VPC and create a Pod subnet in each AZ
VPC_ID=$(aws eks describe-cluster --name eks-mng --query cluster.resourcesVpcConfig.vpcId --output text)
aws ec2 associate-vpc-cidr-block --vpc-id $VPC_ID --cidr-block 100.64.0.0/16
aws ec2 create-subnet --vpc-id $VPC_ID --availability-zone ca-central-1a --cidr-block 100.64.0.0/19
# …repeat for 1b and 1d, and associate the private route tables
# 2) Enable custom networking
aws eks update-addon --cluster-name eks-mng --addon-name vpc-cni --resolve-conflicts PRESERVE \
--configuration-values '{"env":{"AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG":"true","ENI_CONFIG_LABEL_DEF":"topology.kubernetes.io/zone"}}'
apiVersion: crd.k8s.amazonaws.com/v1alpha1
kind: ENIConfig
metadata:
name: ca-central-1a
spec:
subnet: subnet-0123pod1a
securityGroups:
- sg-0123nodesg
Only nodes created after this change use the Pod subnets. Existing nodes must be rolled out and replaced. The primary ENI no longer gives IPs to Pods, so the max pods formula becomes (ENIs − 1) × (IPs per ENI − 1) + 2.
5. Security Groups for Pods
apiVersion: vpcresources.k8s.aws/v1beta1
kind: SecurityGroupPolicy
metadata:
name: api-db-access
namespace: shop
spec:
podSelector:
matchLabels: { app: api }
securityGroups:
groupIds:
- sg-0aaaa-api-to-rds # Source allowed by the RDS security group
- sg-0bbbb-cluster # Still must allow DNS and in-cluster traffic
kubectl -n kube-system set env ds aws-node ENABLE_POD_ENI=true # or use --configuration-values
kubectl get nodes -L vpc.amazonaws.com/has-trunk-attached
kubectl -n shop get pod -l app=api -o jsonpath='{.items[0].metadata.annotations.vpc\.amazonaws\.com/pod-eni}'
Lab 2: Observe IP allocation and trigger an “IP exhaustion” (about 15 minutes, eks-mng branch; Auto Mode can do the first 2 steps)
aws ec2 describe-subnets --filters Name=vpc-id,Values=$VPC_ID Name=tag:kubernetes.io/role/internal-elb,Values=1 \ --query "Subnets[].[AvailabilityZone,CidrBlock,AvailableIpAddressCount]" --output table
kubectl -n shop scale deploy/api --replicas=30
kubectl -n shop get pod -o wide | awk '{print $6, $7}' | sort | uniq -c | head
# Repeat the command from section 2 and watch each node's ENIs go from 2 to 3kubectl -n shop patch deploy api -p '{"spec":{"template":{"spec":{"nodeName":"'$NODE'"}}}}'
kubectl -n shop scale deploy/api --replicas=40
kubectl -n shop get pod --field-selector status.phase!=Running
NAME READY STATUS RESTARTS AGE api-5d9c7c8f9b-x2k8q 0/1 ContainerCreating 0 45s api-5d9c7c8f9b-z7m1p 0/1 ContainerCreating 0 45s
Using nodeName bypasses the scheduler's Pod capacity check, so the Pod is placed directly on the node and fails at the CNI stage. This reproduces the symptoms of a “subnet IP exhaustion” failure. In a real incident, the scheduler believes the Pod can be scheduled, but ipamd cannot get an IP from the subnet.
kubectl -n shop describe pod api-5d9c7c8f9b-x2k8q | sed -n '/Events/,$p' kubectl -n kube-system logs ds/aws-node -c aws-node --tail=30 | grep -i -E "ip|eni" # On the node (SSM Session Manager): sudo tail -n 50 /var/log/aws-routed-eni/ipamd.log
Warning FailedCreatePodSandBox … plugin type="aws-cni" name="aws-cni" failed (add): add cmd: failed to assign an IP address to container
kubectl -n shop patch deploy api --type=json -p='[{"op":"remove","path":"/spec/template/spec/nodeName"}]'
kubectl -n shop scale deploy/api --replicas=2Case 1: The “mysterious” ContainerCreating in a /24 subnet
Problem: The cluster uses 3 private /24 subnets. During the nightly batch job, when scaling to 300 Pods, many Pods get stuck. Analysis: Each node's warm pool holds 10–20 addresses. Together with the ENIs for the NLB, RDS and Lambda, the subnets' AvailableIpAddressCount drops to zero. Approach: In the short term, set WARM_IP_TARGET=5, MINIMUM_IP_TARGET=10 to reduce idle addresses. In the medium term, add a secondary 100.64.0.0/16 CIDR to the VPC and enable custom networking. For new clusters, plan private subnets of /19 or larger from the start. Limitation: A WARM_IP_TARGET that is too small increases EC2 API calls, which can trigger throttling during large scale-outs.
Case 2: 3× higher Pod density
A microservices platform runs many small Pods that request 100m CPU. On m6i.large nodes, the 29-Pod limit held CPU utilization to only 20%. After enabling prefix delegation and creating a new node group with max pods set to 110, the node count dropped from 60 to 22. Limitation: Fragmented subnets caused InsufficientCidrBlocks. This was solved by reserving contiguous address blocks for prefixes with subnet CIDR reservations.
Case 3: Only api can reach RDS
A compliance requirement states that “the database only accepts connections from the application tier.” With Security Groups for Pods, the RDS security group allows only sg-api, and a SecurityGroupPolicy binds sg-api to Pods labeled app=api. Limitation: The number of branch ENIs is limited by the instance type. Pods that use SG for Pods do not pass through the node security group by default, so CoreDNS must be allowed explicitly (or you can set POD_SECURITY_GROUP_ENFORCING_MODE).
Common errors and fixes
FailedCreatePodSandBox … plugin type="aws-cni" … failed (add): add cmd: failed to assign an IP address to container
Cause: ① The subnet has no free IPs. ② The node's ENIs × IPs are full (max pods was bypassed or set higher than the formula's result). ③ ipamd's EC2 API calls fail (the node role, or the IRSA or Pod Identity role, lacks AmazonEKS_CNI_Policy, or the API is throttled).
aws ec2 describe-subnets --subnet-ids subnet-… --query "Subnets[].AvailableIpAddressCount"
kubectl -n kube-system logs ds/aws-node -c aws-node --tail=50
kubectl get node N -o jsonpath='{.status.allocatable.pods}'; kubectl get pods -A --field-selector spec.nodeName=N | wc -l
Fix: Enlarge or add subnets or a secondary CIDR, enable prefix delegation, lower WARM_*, and fix the CNI's IAM permissions.
Node NotReady: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
Cause: aws-node did not start on this node (image pull failure, IAM permissions, incompatible kube-proxy version, or a failed add-on upgrade).
kubectl -n kube-system get pods -l k8s-app=aws-node -o wide --field-selector spec.nodeName=N
kubectl -n kube-system describe pod aws-node-xxxxx | sed -n '/Events/,$p'
aws eks describe-addon --cluster-name eks-mng --addon-name vpc-cni --query "addon.{v:addonVersion,s:status,h:health}"After enabling prefix delegation: InsufficientCidrBlocks: There are not enough free cidr blocks in the specified subnet
Cause: The subnet has no contiguous, aligned free /28 block (scattered by single-IP allocations).
Fix: Create a subnet CIDR reservation for the prefixes (aws ec2 create-subnet-cidr-reservation --reservation-type prefix), or move to a new subnet. Avoid mixing nodes in secondary-IP mode and prefix mode in the same subnet.
Pods can reach the internet, but when they access the company network (through the TGW), the other side sees the node's IP as the source
Cause: By default, VPC CNI applies SNAT to destinations outside the VPC CIDR (AWS_VPC_K8S_CNI_EXTERNALSNAT=false).
Fix: If you need to preserve Pod IPs, set AWS_VPC_K8S_CNI_EXTERNALSNAT=true (for internet access, rely on the NAT GW instead), or use AWS_VPC_K8S_CNI_EXCLUDE_SNAT_CIDRS to exclude the company's network ranges. If the company network cannot route the Pod CIDR from custom networking, keep the default SNAT.
1. An instance has 4 ENIs with 15 IPv4 addresses each. In secondary-IP mode, what is the max pods value? Write the commands that query these two numbers.
Reference answer
4 × (15 − 1) + 2 = 58.
aws ec2 describe-instance-types --instance-types c6i.xlarge \ --query "InstanceTypes[].NetworkInfo.[MaximumNetworkInterfaces,Ipv4AddressesPerInterface]"
2. Set WARM_IP_TARGET to 5 and MINIMUM_IP_TARGET to 10 through the managed add-on.
Reference answer
aws eks update-addon --cluster-name eks-mng --addon-name vpc-cni --resolve-conflicts PRESERVE \
--configuration-values '{"env":{"WARM_IP_TARGET":"5","MINIMUM_IP_TARGET":"10"}}'Scenario analysis: The company gave EKS a single VPC, 10.50.0.0/23 (which must be reachable from the on-premises data center). About 400 Pods are expected. How would you design this?
Reference answer
A /23 has only about 500 addresses, and room is needed for nodes, load balancers and endpoints, so 400 Pods cannot all use the primary CIDR. Approach: associate a secondary CIDR with the VPC (100.64.0.0/16, used only inside the VPC) → create Pod subnets in each AZ → custom networking with ENIConfig. Pods reach the data center through node SNAT. Services that the data center must reach directly are exposed through an internal NLB or ALB, with the load balancer in subnets from the primary CIDR. Alternatively, evaluate an IPv6 cluster. When you enable prefix delegation to raise density, also watch for /28 fragmentation in the Pod subnets.
Teaching video (title and channel verified via YouTube oEmbed, 2026-11-15)
Official docs
- Best Practices · Amazon VPC CNI
- Prefix mode for Linux
- Custom networking
- Security groups per Pod
- WARM_ENI_TARGET / WARM_IP_TARGET / MINIMUM_IP_TARGET
Video storyboard script
This lesson cannot generate the video or MP3 directly, so it provides a storyboard and a narration script instead.
Narration: VPC CNI's ipamd attaches a network interface ahead of time and requests a batch of IPs. This is the warm pool.
Narration: The Pod gets a real address from the subnet, so the load balancer can send traffic directly to the Pod.
Narration: The number of network interfaces multiplied by the addresses per interface sets the Pod limit. Running out of subnet addresses looks the same.
Narration: Prefix delegation raises density, and the secondary address range solves the shortage in the primary range. The two can be combined.
Module 3 · Identity: access entries and EKS Pod Identity / IRSA
- Explain EKS authentication (IAM-signed token → IAM Authenticator) and authorization (access entries / access policy / Kubernetes RBAC).
- Distinguish the three authentication modes
CONFIG_MAP,API_AND_CONFIG_MAPandAPI, and migrate the aws-auth ConfigMap to access entries. - Use EKS Pod Identity to give Pods temporary credentials. Explain the Pod Identity Agent,
AssumeRoleForPodIdentityand session tags. Compare with IRSA (OIDC +AssumeRoleWithWebIdentity). - Write a least-privilege policy that allows reading only one S3 prefix, and verify it.
What: the two identity chains on EKS
| Direction | Authentication (who you are) | Authorization (what you can do) | AKS equivalent |
|---|---|---|---|
| People / CI → Kubernetes API | The kubectl exec plugin runs aws eks get-token, which generates a presigned STS GetCallerIdentity request and uses it as a bearer token. The control plane's AWS IAM Authenticator verifies it and gets the IAM principal ARN. | access entry (IAM principal → Kubernetes username / groups) + access policy (AWS-managed permission set, which can be scoped to namespaces) or Kubernetes RBAC | Entra ID token + Azure RBAC / Kubernetes RBAC |
| Pod → AWS API | Pod's ServiceAccount projected token | Exchanged for temporary credentials of an IAM role; IAM policies determine permissions | Workload Identity (federated credential) |
Why: why migrate from aws-auth to access entries
The old method stored the “IAM role → Kubernetes group” mapping in the kube-system/aws-auth ConfigMap. One formatting error could lock everyone out, including nodes. Only people who already had cluster access could change it, and it could not be audited through IAM or CloudTrail. Access entries move the mapping into the EKS API. You can manage them with the CLI, CloudFormation or Terraform, control who can change them with IAM policies, record changes in CloudTrail, and repair a broken cluster from outside. Auto Mode requires access entries.
| Authentication mode | Available methods | Description |
|---|---|---|
CONFIG_MAP | aws-auth only | The oldest method |
API_AND_CONFIG_MAP | Both, stored independently | Migration transition period |
API | Access entries only | Recommended end state |
The mode can only move forward: once access entries are enabled, they cannot be turned off. A cluster created without the ConfigMap option cannot enable it later. For managed node groups and Fargate, EKS automatically creates the matching access entries for the node roles (types EC2_LINUX / FARGATE_LINUX).
How (people): access entry + access policy
- Access entry types:
STANDARD(people, CI),EC2_LINUX/EC2_WINDOWS/FARGATE_LINUX(nodes),EC2(custom node role in Auto Mode), and so on. - Common access policies (ARNs look like
arn:aws:eks::aws:cluster-access-policy/name):AmazonEKSClusterAdminPolicy(equivalent to cluster-admin),AmazonEKSAdminPolicy(namespace admin),AmazonEKSEditPolicy,AmazonEKSViewPolicy,AmazonEKSAdminViewPolicy(can read Secrets),AmazonEKSSecretReaderPolicy, and others. The access scope is eitherclusterornamespace. - For custom permissions, set
--kubernetes-groupson the access entry, then bind the group with a Kubernetes RoleBinding (the hour 5 RBAC applies fully).
How (Pods): EKS Pod Identity
- You create a Pod Identity association: (cluster, namespace, ServiceAccount) → IAM role. The role's trust policy principal is the service
pods.eks.amazonaws.com, and it allowssts:AssumeRoleandsts:TagSession. It does not contain any cluster ID, so the same role can be reused across multiple clusters. - When a Pod is created, EKS's Pod Identity webhook injects the following into Pods that use the ServiceAccount: the environment variables
AWS_CONTAINER_CREDENTIALS_FULL_URI=http://169.254.170.23/v1/credentialsandAWS_CONTAINER_AUTHORIZATION_TOKEN_FILE=/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token, plus a projected ServiceAccount token with audiencepods.eks.amazonaws.comand a 24-hour lifetime. - The AWS SDK in the application uses the default credential chain to find the container credential provider. It sends the token to the Pod Identity Agent on the node (a DaemonSet with hostNetwork, listening on the link-local address 169.254.170.23).
- The Agent calls the EKS Auth API
AssumeRoleForPodIdentity(passing the token). EKS verifies the token and finds the association, then returns temporary credentials for the role. It also adds session tags automatically (such aseks-cluster-name,kubernetes-namespace,kubernetes-service-account,kubernetes-pod-name), which IAM policies can use for ABAC throughaws:PrincipalTag/…. - The SDK caches the credentials and refreshes them before they expire.
When: Pod Identity or IRSA
| Dimension | EKS Pod Identity | IRSA (IAM Roles for Service Accounts) |
|---|---|---|
| Prerequisites | eks-pod-identity-agent add-on (built into Auto Mode) | One IAM OIDC identity provider per cluster |
| Where it is bound | Association in the EKS API (managed outside the cluster) | ServiceAccount annotation eks.amazonaws.com/role-arn + the OIDC issuer and sub hardcoded in the role's trust policy |
| Reusing the role across clusters | Yes (the trust policy does not contain a cluster) | Each new cluster requires changing the trust policy (trust policies have a length limit) |
| Credential exchange | Agent → EKS Auth AssumeRoleForPodIdentity | SDK → STS AssumeRoleWithWebIdentity |
| ABAC session tags | Added automatically | None (you design them yourself) |
| Applies to | Most scenarios on EKS (including Auto Mode) | Fargate, EKS Anywhere, self-managed clusters, scenarios that need cross-account OIDC, and older SDK versions |
sts get-caller-identity in the access entry”: that is the session ARN. You must use the IAM role ARN (SSO roles include the /aws-reserved/sso.amazonaws.com/ path). ③ “Once Pod Identity is configured, the application will use it”: if the container has higher-priority credentials, such as the AWS_ACCESS_KEY_ID environment variable, the SDK uses those first. ④ “The Pod Identity trust policy must reference OIDC”: it does not. The principal is pods.eks.amazonaws.com.People → cluster: authentication and authorization
Pods → AWS: data flow comparison of Pod Identity and IRSA
Core animation: the Pod Identity credential retrieval flow
Switch between the “normal” and “association missing” scenarios, and watch the real API calls and environment variables at each step.
Command table
| Command | Purpose | Key parameters |
|---|---|---|
aws eks list-access-entries --cluster-name X | List all IAM principals that can access the cluster | - |
aws eks create-access-entry --cluster-name X --principal-arn ARN | Create an access entry | --type STANDARD, --kubernetes-groups, --username |
aws eks associate-access-policy … | Associate an access policy | --policy-arn, --access-scope type=cluster|namespace,namespaces=… |
aws eks list-associated-access-policies … | View a principal's policies and scope | - |
aws eks update-cluster-config --name X --access-config authenticationMode=API_AND_CONFIG_MAP | Change the authentication mode (forward only) | - |
eksctl create podidentityassociation / aws eks create-pod-identity-association | Create a Pod Identity association | --namespace --service-account(-name) --role-arn |
aws eks list-pod-identity-associations --cluster-name X | List associations | --namespace |
eksctl create iamserviceaccount | IRSA: create a role + annotated ServiceAccount | --attach-policy-arn --approve |
kubectl auth whoami | Current Kubernetes identity (username, groups, ARN in extra) | - |
1. Give colleague bob (SSO role) read-only access to the shop namespace
ROLE_ARN=arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/ca-central-1/AWSReservedSSO_Developers_0123456789abcdef aws eks create-access-entry --cluster-name eks-lab --principal-arn $ROLE_ARN --type STANDARD aws eks associate-access-policy --cluster-name eks-lab --principal-arn $ROLE_ARN \ --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy \ --access-scope type=namespace,namespaces=shop aws eks list-associated-access-policies --cluster-name eks-lab --principal-arn $ROLE_ARN
{
"associatedAccessPolicies": [{
"policyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy",
"accessScope": { "type": "namespace", "namespaces": ["shop"] },
"associatedAt": "2026-11-15T10:40:12-05:00"
}]
}
How to verify: bob runs kubectl auth whoami and kubectl -n shop get pods (succeeds), and kubectl -n kube-system get pods (403). Common mistake: entering the session ARN (arn:aws:sts::…:assumed-role/…) causes a parameter error or a 401 at login. Production use: manage access entries with Terraform or CloudFormation, and map permission groups to Identity Center permission sets.
2. Custom permissions: access entry + Kubernetes group + RoleBinding
aws eks create-access-entry --cluster-name eks-lab --principal-arn arn:aws:iam::111122223333:role/ci-deployer \ --type STANDARD --kubernetes-groups shop-deployers kubectl -n shop create rolebinding ci-deploy --clusterrole=edit --group=shop-deployers
3. Migrate from aws-auth (legacy cluster)
kubectl -n kube-system get cm aws-auth -o yaml # Back up first aws eks update-cluster-config --name old-cluster --access-config authenticationMode=API_AND_CONFIG_MAP aws eks wait cluster-active --name old-cluster # For each people / CI entry in mapRoles, create an equivalent access entry (EKS manages the node role entries automatically, so do not migrate them) eksctl get iamidentitymapping --cluster old-cluster # After verifying that everyone can sign in through access entries: aws eks update-cluster-config --name old-cluster --access-config authenticationMode=API
4. Pod Identity: least-privilege read access to an S3 prefix
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "Service": "pods.eks.amazonaws.com" },
"Action": ["sts:AssumeRole", "sts:TagSession"]
}]
}
{
"Version": "2012-10-17",
"Statement": [
{ "Sid": "List", "Effect": "Allow", "Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::shop-assets-111122223333",
"Condition": { "StringLike": { "s3:prefix": ["shop/*"] } } },
{ "Sid": "Read", "Effect": "Allow", "Action": "s3:GetObject",
"Resource": "arn:aws:s3:::shop-assets-111122223333/shop/*",
"Condition": { "StringEquals": { "aws:PrincipalTag/kubernetes-namespace": "shop" } } }
]
}
aws iam create-role --role-name shop-api-s3-read --assume-role-policy-document file://trust.json aws iam put-role-policy --role-name shop-api-s3-read --policy-name s3-read --policy-document file://s3-read.json kubectl -n shop create serviceaccount api aws eks create-pod-identity-association --cluster-name eks-lab --namespace shop \ --service-account api --role-arn arn:aws:iam::111122223333:role/shop-api-s3-read # Clusters with managed node groups also need the add-on: aws eks create-addon --cluster-name eks-mng --addon-name eks-pod-identity-agent (built into Auto Mode)
Common mistake: The webhook injects the association when a Pod is created, so existing Pods do not get it automatically. Run kubectl rollout restart.
5. IRSA comparison (eks-mng already has withOIDC)
eksctl create iamserviceaccount --cluster eks-mng --namespace shop --name api-irsa \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess --approve
kubectl -n shop get sa api-irsa -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}'
aws iam get-role --role-name $(kubectl -n shop get sa api-irsa -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}' | cut -d/ -f2) \
--query Role.AssumeRolePolicyDocument # You should see Federated: oidc-provider/… and :sub = system:serviceaccount:shop:api-irsa
Lab 3: A Pod can read only one S3 prefix (about 15 minutes; S3 costs are negligible)
ACCT=$(aws sts get-caller-identity --query Account --output text); BUCKET=shop-assets-$ACCT aws s3 mb s3://$BUCKET --region ca-central-1 echo "hello from shop" > banner.txt; echo "secret" > admin.txt aws s3 cp banner.txt s3://$BUCKET/shop/banner.txt aws s3 cp admin.txt s3://$BUCKET/admin/admin.txt
$BUCKET).kubectl -n shop run s3test --image=public.ecr.aws/aws-cli/aws-cli:latest --restart=Never \
--overrides='{"spec":{"serviceAccountName":"api"}}' --command -- sleep 3600
kubectl -n shop wait --for=condition=Ready pod/s3test --timeout=120s
kubectl -n shop exec s3test -- env | grep AWS_CONTAINER
kubectl -n shop exec s3test -- aws sts get-caller-identity
kubectl -n shop exec s3test -- aws s3 cp s3://$BUCKET/shop/banner.txt -
kubectl -n shop exec s3test -- aws s3 cp s3://$BUCKET/admin/admin.txt -
AWS_CONTAINER_CREDENTIALS_FULL_URI=http://169.254.170.23/v1/credentials
AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE=/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token
{ "Arn": "arn:aws:sts::111122223333:assumed-role/shop-api-s3-read/eks-eks-lab-s3test-…" }
hello from shop
download failed: s3://shop-assets-111122223333/admin/admin.txt to - An error occurred (403) when calling the HeadObject operation: Forbiddendefault namespace, create a ServiceAccount with the same name but no association. It gets no credentials. Create an association for default/api as well, and it can assume the role, but GetObject is denied because the kubernetes-namespace tag is not shop.kubectl -n shop delete pod s3test # Keep the role and association for the capstone lab. For full cleanup: # aws eks delete-pod-identity-association --cluster-name eks-lab --association-id $(aws eks list-pod-identity-associations --cluster-name eks-lab --query "associations[0].associationId" --output text) # aws s3 rb s3://$BUCKET --force; aws iam delete-role-policy --role-name shop-api-s3-read --policy-name s3-read; aws iam delete-role --role-name shop-api-s3-read
Case 1: A mistaken aws-auth edit locks out everyone
Problem: An operator used kubectl edit to change aws-auth and got the YAML indentation wrong. Everyone, including the nodes, could no longer authenticate, and the nodes went NotReady one by one. Approach: The identity that created the cluster could still sign in (under the old mechanism, the creator implicitly had system:masters). The ConfigMap was repaired. Then the cluster was switched to API_AND_CONFIG_MAP, everyone's mappings were migrated to access entries, and finally it was switched to API. Limitation: On a legacy cluster, the “implicit creator” is not in aws-auth. When migrating, you must explicitly create an access entry for that identity, or access may be lost after switching to API.
Case 2: One IAM role serving 20 clusters
In the IRSA era, the OIDC issuer of every cluster had to be written into the role's trust policy. When the trust policy reached its length limit, the role had to be split. After migrating to Pod Identity, the trust policy is fixed to pods.eks.amazonaws.com, and the permission policy uses aws:PrincipalTag/eks-cluster-name to separate environments. Limitation: All applications need a recent AWS SDK that supports the container credential provider.
Case 3: Least-privilege deployment for a CI pipeline
GitHub Actions federates through OIDC to the AWS role ci-deployer. That role's access entry maps only to the Kubernetes group shop-deployers. The RoleBinding grants only the edit role in the shop namespace. The IAM policy allows only eks:DescribeCluster (needed to generate kubeconfig).
Common errors and fixes
error: You must be logged in to the server (Unauthorized)
Cause: Authentication failed. The current IAM principal has no access entry, the SSO session expired, or kubeconfig uses the wrong profile or --role-arn.
aws sts get-caller-identity --profile eks-lab aws eks list-access-entries --cluster-name eks-lab --query "accessEntries[?contains(@,'Developers')]" aws sso login --profile eks-lab aws eks update-kubeconfig --name eks-lab --profile eks-lab
Error from server (Forbidden): pods is forbidden: User "arn:aws:sts::111122223333:assumed-role/…" cannot list resource "pods" in API group "" in the namespace "kube-system"
Cause: Authenticated, but the access policy scope covers only shop, or there is no RBAC binding.
aws eks list-associated-access-policies --cluster-name eks-lab --principal-arn $ROLE_ARN kubectl auth can-i --list -n kube-system --as=… # An admin checks on your behalf
In a Pod: Unable to locate credentials / NoCredentialProviders (a Pod Identity association has been created)
Cause: ① The Pod started before the association was created (no env injected). ② The ServiceAccount name or namespace does not match the association. ③ The managed node group cluster does not have eks-pod-identity-agent installed. ④ The SDK is too old and does not support the container credential provider.
kubectl -n shop get pod P -o jsonpath='{.spec.serviceAccountName}{"\n"}'; kubectl -n shop exec P -- env | grep AWS_
aws eks list-pod-identity-associations --cluster-name eks-lab --namespace shop
kubectl -n kube-system get ds eks-pod-identity-agent # Non-Auto Mode clusters only
kubectl -n shop rollout restart deploy/apiAn error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity (IRSA)
Cause: The OIDC issuer, sub (system:serviceaccount:namespace:name), or aud (sts.amazonaws.com) in the role's trust policy does not match, or the cluster has no IAM OIDC provider.
aws eks describe-cluster --name eks-mng --query cluster.identity.oidc.issuer aws iam list-open-id-connect-providers
1. Give the IAM role platform-admins full administrator access to the whole cluster.
Reference answer
ARN=arn:aws:iam::111122223333:role/platform-admins aws eks create-access-entry --cluster-name eks-lab --principal-arn $ARN aws eks associate-access-policy --cluster-name eks-lab --principal-arn $ARN \ --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy --access-scope type=cluster
2. Use eksctl to create a Pod Identity association for shop/worker, attaching the AWS managed policy AmazonSQSReadOnlyAccess (so eksctl creates the role automatically).
Reference answer
eksctl create podidentityassociation --cluster eks-lab --namespace shop \ --service-account-name worker --permission-policy-arns arn:aws:iam::aws:policy/AmazonSQSReadOnlyAccess
Scenario analysis: A security audit found that every Pod can get the node role's credentials through IMDS, and the node role has full S3 access. Give the remediation steps.
Reference answer
① Remove application permissions such as S3 from the node role. The node role keeps only AmazonEKSWorkerNodePolicy, the CNI permissions (or move them to Pod Identity), and ECR pull permissions. ② For each workload that needs AWS permissions, create a separate role and a Pod Identity association (least privilege + session-tag ABAC). ③ In the launch template, require IMDSv2 and set HttpPutResponseHopLimit=1, so the container network namespace cannot reach IMDS (Auto Mode already restricts this by default). ④ Use a NetworkPolicy to block Pods from reaching 169.254.169.254. ⑤ Use CloudTrail to verify that applications no longer use the node role.
Teaching video (title and channel verified via YouTube oEmbed, 2026-11-15)
No official video with a verifiable ID was found for the access entries topic, so only a storyboard script is provided.
Official docs
- Grant IAM users and roles access to Kubernetes APIs
- Access entries
- Access policy permissions
- EKS Pod Identity
- How Pod Identity works
- IRSA
Video storyboard script
This lesson cannot generate the video or MP3 directly, so it provides a storyboard and a narration script instead.
Narration: Identity in EKS runs in two directions: who can operate the cluster, and which AWS resources the Pods inside the cluster can operate.
Narration: IAM proves who you are. The access entry maps you to a user and groups in the cluster. The access policy or RBAC decides what you can do.
Narration: The node agent exchanges credentials for Pod Identity on the Pod's behalf. The role's trust policy is not tied to a cluster, so the role can be reused.
Narration: Do not put application permissions on the node role, or every Pod on the node can use them.
Module 4 · Traffic: AWS Load Balancer Controller and Gateway API
- Explain how the AWS Load Balancer Controller (LBC) watches Ingress / Service / Gateway and calls the ELBv2 API to create ALBs, NLBs, target groups, listeners and rules.
- Distinguish the
instanceandiptarget types. Understand how VPC CNI makes IP mode possible, and what the readiness gate does. - Master subnet discovery tags, common annotations, sharing one ALB through an IngressGroup, ACM certificates, and HTTPS redirects.
- Understand LBC's support status for Gateway API, and how Auto Mode's built-in load balancing differs.
What: what LBC is
The AWS Load Balancer Controller is a controller that runs in the cluster (a Deployment, 2 replicas by default, with an admission webhook). It watches Kubernetes objects and translates them into Elastic Load Balancing resources:
| Kubernetes object | AWS resource | Selection criteria |
|---|---|---|
Ingress (ingressClassName: alb) | Application Load Balancer (L7) + listeners + rules + target groups | IngressClass controller is ingress.k8s.aws/alb (eks.amazonaws.com/alb in Auto Mode) |
Service type: LoadBalancer | Network Load Balancer (L4) | spec.loadBalancerClass: service.k8s.aws/nlb (eks.amazonaws.com/nlb in Auto Mode), or the annotation aws-load-balancer-type: external |
| Gateway + HTTPRoute / GRPCRoute | ALB | LBC Gateway API (L7) |
| Gateway + TCPRoute / UDPRoute / TLSRoute | NLB | LBC Gateway API (L4) |
| TargetGroupBinding (CRD) | Registers Pods with an existing target group | When the LB is managed by Terraform and Kubernetes manages only the targets |
Without LBC, type: LoadBalancer is created by the AWS cloud controller built into Kubernetes, as a Classic LB / NLB (instance mode). Its features are limited, so do not rely on it for new clusters.
Why: IP target mode
Instance mode: targets are the nodes' NodePorts. Traffic goes LB → any node → kube-proxy → Pod, which can add another hop, possibly across nodes or AZs. IP mode: because VPC CNI gives Pods real VPC IPs, the target group registers Pod IPs directly. This removes a hop, gives more accurate health checks, and supports Fargate. LBC also provides a Pod readiness gate. After you label a namespace with elbv2.k8s.aws/pod-readiness-gate-inject=enabled, a Pod counts as Ready only after the target group's health check passes. During a rolling update, this prevents traffic loss from a Pod that Kubernetes considers Ready while the ALB has not yet registered it.
How: the controller's reconciliation loop
- Watches an Ingress (or several Ingresses in an IngressGroup) → builds a desired model (LB, listeners, rules, target groups).
- Subnet discovery: A public ALB selects subnets tagged
kubernetes.io/role/elb=1, and an internal ALB selects subnets taggedkubernetes.io/role/internal-elb=1(one per AZ; eksctl applies these automatically). You can also specify subnets with the annotationalb.ingress.kubernetes.io/subnets. - Calls the ELBv2 API:
CreateLoadBalancer,CreateTargetGroup,CreateListener,CreateRule. Creates security groups (a frontend SG plus a shared backend SG) and updates inbound rules on the node / Pod security groups. - Creates a TargetGroupBinding for each backend Service, registering Pod IPs from the EndpointSlice (
RegisterTargets), and adds or removes them as Pods change. - Writes the ALB DNS name back to
Ingress.status.loadBalancer.ingress[0].hostname. When an Ingress is deleted (finalizeringress.k8s.aws/resources), the AWS resources are deleted in reverse.
When: Ingress, Service or Gateway API
- HTTP(S) for external access: ALB. The traditional approach uses an Ingress with annotations. For new projects, consider Gateway API (HTTPRoute).
- TCP/UDP, fixed IPs, very low latency, preserving the source IP: NLB (Service LoadBalancer).
- Gateway API status (follow the official docs): The LBC docs label Gateway API as “New”. It is built on Gateway API v1.6.0 and passes the v1.6.0 conformance tests. ALB (HTTPRoute, GRPCRoute) requires LBC ≥ 2.14.0, and NLB (TCPRoute, UDPRoute, TLSRoute) requires ≥ 2.13.3. Starting with v3.5.0, L4 routes use the v1 API. You first install the standard Gateway API CRDs and LBC's
gateway-crds.yaml(TargetGroupConfiguration, LoadBalancerConfiguration, ListenerRuleConfiguration). The controller enables Gateway API automatically when the CRDs exist (you can turn it off with the feature gatesALBGatewayAPI/NLBGatewayAPI). A single Gateway cannot mix L4 and L7 routes. - Auto Mode: Load balancing is built in (no LBC install needed). It supports Ingress (IngressClassParams
eks.amazonaws.com/v1) and Service NLB (cluster defaultloadBalancerClass: eks.amazonaws.com/nlb). Some LBC annotations are not supported. For example,alb.ingress.kubernetes.io/group.namemust instead be set asgroup.namein IngressClassParams. For Gateway API support in Auto Mode, follow the official EKS docs.
Comparison with AKS
| Dimension | EKS | AKS (hour 6) |
|---|---|---|
| Default implementation of Service LoadBalancer | LBC / Auto Mode → NLB; or the built-in cloud controller | AKS cloud controller → Azure Standard Load Balancer (one LB shared, with multiple frontend IPs) |
| L7 ingress | One ALB per Ingress (or IngressGroup) | App routing add-on (in-cluster proxy) / AGC |
| Traffic to Pods | IP mode goes directly to Pods | Via node or AGC directly to Pods (depending on the design) |
| TLS certificate | ACM (terminated at the ALB) | Key Vault / cert-manager |
alb.ingress.kubernetes.io/group.name) to share one ALB across several Ingresses. ② “Deleting the cluster deletes the ALB”: it does not. The ALB is created by the controller, so once you delete the controller first, nothing removes the ALB (M8). ③ “The NLB instance mode can preserve the source IP too”: with externalTrafficPolicy: Cluster, instance mode SNATs the source IP, so use IP mode instead. ④ “ingress-nginx can still be used”: the project was archived in 2026-03 and no longer receives security patches (hour 3).Ingress → ALB (IP targets) and Service → NLB
IngressGroup: several Ingresses share one ALB
Step-by-step animation: how the ALB appears after kubectl apply -f shop-ingress.yaml
Switch between “normal” and “subnet missing the tag (common mistake)”.
Command table
| Command / object | Purpose | Key parameters |
|---|---|---|
helm upgrade --install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system | Install LBC (not Auto Mode) | clusterName, serviceAccount.name, vpcId, region |
alb.ingress.kubernetes.io/target-type: ip | IP targets | Default instance (IngressClassParams in Auto Mode defaults to ip) |
alb.ingress.kubernetes.io/scheme: internet-facing|internal | Public / internal | Default internal |
alb.ingress.kubernetes.io/listen-ports, certificate-arn, ssl-redirect | HTTPS and redirect | The ACM certificate must be in the same region as the ALB |
alb.ingress.kubernetes.io/group.name / group.order | Shared ALB | Auto Mode uses group.name in IngressClassParams instead |
alb.ingress.kubernetes.io/healthcheck-path | Target group health check path | podinfo: /readyz |
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip | NLB IP targets | Used together with loadBalancerClass |
kubectl label ns shop elbv2.k8s.aws/pod-readiness-gate-inject=enabled | Pod readiness gate | Only newly created Pods get the readiness gate injected |
1. Install LBC (eks-mng, using Pod Identity)
LBC_VER=v3.6.3 curl -sSLo iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/$LBC_VER/docs/install/iam_policy.json aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json eksctl create podidentityassociation --cluster eks-mng --namespace kube-system \ --service-account-name aws-load-balancer-controller --create-service-account \ --permission-policy-arns arn:aws:iam::$ACCT:policy/AWSLoadBalancerControllerIAMPolicy helm repo add eks https://aws.github.io/eks-charts && helm repo update eks helm upgrade --install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system \ --set clusterName=eks-mng --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller \ --set region=ca-central-1 --set vpcId=$VPC_ID kubectl -n kube-system rollout status deploy/aws-load-balancer-controller kubectl get ingressclass
deployment "aws-load-balancer-controller" successfully rolled out NAME CONTROLLER PARAMETERS AGE alb ingress.k8s.aws/alb <none> 20s
The mapping between the chart version and the controller version follows the eks-charts release notes. The IAM policy file must match the controller version, because new versions often add permissions. Common mistake: If the controller log shows AccessDenied … elasticloadbalancing:DescribeListenerAttributes, the IAM policy is out of date.
2. shop's ALB Ingress (self-installed LBC version)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/healthcheck-path: /readyz
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80}]'
# With a domain name and an ACM certificate:
# alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
# alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:ca-central-1:111122223333:certificate/…
# alb.ingress.kubernetes.io/ssl-redirect: "443"
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /api
pathType: Prefix
backend: { service: { name: api, port: { number: 9898 } } }
- path: /
pathType: Prefix
backend: { service: { name: web, port: { number: 80 } } }
3. Auto Mode version (eks-lab, no LBC install)
apiVersion: eks.amazonaws.com/v1
kind: IngressClassParams
metadata:
name: alb
spec:
scheme: internet-facing
# targetType defaults to ip; group.name: shop lets multiple Ingresses share an ALB
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: alb
spec:
controller: eks.amazonaws.com/alb
parameters:
apiGroup: eks.amazonaws.com
kind: IngressClassParams
name: alb
In Auto Mode, the Ingress itself is written the same way (ingressClassName: alb), but annotations cannot be set on the IngressClass. Put all class-level configuration in IngressClassParams. Some annotations on the Ingress still work (such as the health check path and conditions).
4. NLB: internal TCP service (IP targets)
apiVersion: v1
kind: Service
metadata:
name: api-nlb
namespace: shop
annotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: internal
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-healthcheck-path: /healthz
service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol: HTTP
spec:
type: LoadBalancer
loadBalancerClass: service.k8s.aws/nlb # Auto Mode: eks.amazonaws.com/nlb (cluster default, can be omitted)
selector: { app: api }
ports: [{ port: 80, targetPort: 9898, protocol: TCP }]
kubectl apply -f api-nlb.yaml kubectl -n shop get svc api-nlb -w # EXTERNAL-IP shows k8s-shop-apinlb-xxxx.elb.ca-central-1.amazonaws.com aws elbv2 describe-target-health --target-group-arn $(aws elbv2 describe-target-groups --query "TargetGroups[?contains(TargetGroupName,'apinlb')].TargetGroupArn" --output text)
5. Gateway API (LBC; follow the official docs)
# Standard Gateway API CRDs (v1.6.x) and the LBC's Gateway-specific CRDs kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.6.1/standard-install.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v3.6.3/config/crd/gateway/gateway-crds.yaml kubectl -n kube-system rollout restart deploy/aws-load-balancer-controller kubectl get gatewayclass
Fill in the controllerName of the GatewayClass and the apiVersion and fields of LoadBalancerConfiguration according to the LBC Gateway API guide. Use the actual repository paths for the CRD files above in that version. HTTPRoute syntax is exactly the same as in hour 3.
Lab 4: Expose shop with an ALB (about 15 minutes; ALBs are billed by the hour)
kubectl delete ingress and confirm that the ALB has been deleted.kubectl -n shop expose deploy api --port=9898 --target-port=9898 kubectl -n shop create deploy web --image=nginx:1.29-alpine --port=80 kubectl -n shop expose deploy web --port=80 kubectl label ns shop elbv2.k8s.aws/pod-readiness-gate-inject=enabled # Effective only with a self-installed LBC
kubectl apply -f alb-class.yaml # eks-lab; skip on eks-mng (LBC already created the alb class) kubectl apply -f shop-ingress.yaml kubectl -n shop get ingress shop -w
NAME CLASS HOSTS ADDRESS PORTS AGE shop alb * k8s-shop-shop-0a1b2c3d4e-1234567890.ca-central-1.elb.amazonaws.com 80 2m
ALB=$(kubectl -n shop get ingress shop -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
curl -s http://$ALB/ | head -5 # nginx welcome page
curl -s http://$ALB/api/version # Returns 404 if podinfo does not recognize the /api prefix. Observe this and think about how to fix it
aws elbv2 describe-target-groups --query "TargetGroups[?contains(TargetGroupName,'shop')].[TargetGroupName,TargetType,HealthCheckPath]" --output table
kubectl -n shop describe ingress shop | sed -n '/Events/,$p'
Answer to the thinking question: give api its own host rule (api.example.com), or have web (nginx) reverse-proxy /api/ to the api Service and strip the prefix. An ALB rule does not rewrite paths by itself.
kubectl -n shop scale deploy/api --replicas=4 aws elbv2 describe-target-health --target-group-arn <tg-api ARN> --query "TargetHealthDescriptions[].[Target.Id,TargetHealth.State]" --output table kubectl -n shop get pod -l app=api -o wide # Target.Id matches the Pod IP
kubectl -n shop delete ingress shop aws elbv2 describe-load-balancers --query "LoadBalancers[?contains(LoadBalancerName,'k8s-shop')].LoadBalancerName" # should be empty
Case 1: 502 errors during rolling updates
Problem: Every release causes a few seconds of 502 errors on the ALB. Cause: Old Pods receive SIGTERM and exit immediately, but the ALB has not finished deregistering them (the default deregistration delay is 300 seconds). New Pods are marked Ready by Kubernetes, but the target group health check has not passed yet. Fix: Enable the Pod readiness gate. Add preStop: sleep 15 to the container, and set terminationGracePeriodSeconds to a value greater than the deregistration delay. Set the target group attribute deregistration_delay.timeout_seconds=30 (annotation alb.ingress.kubernetes.io/target-group-attributes).
Case 2: 40 microservices, 40 ALBs
One Ingress per team creates 40 ALBs, which adds up to a sizable fixed monthly cost. Use IngressGroup to merge them into two groups, public and internal, and keep the rule count within the ALB rule limit (default 100 rules per listener, which you can ask to raise). Limit: One bad Ingress in a group can block the whole group, so pair it with an admission policy (hour 5 VAP) to validate annotations.
Case 3: A TCP service needs a fixed IP for partner allowlisting
An NLB can attach an Elastic IP to each AZ with the annotation service.beta.kubernetes.io/aws-load-balancer-eip-allocations (the count must match the number of subnets). An ALB cannot have a fixed IP attached directly in front of it, so you need Global Accelerator.
Common errors and fixes
Warning FailedBuildModel … couldn't auto-discover subnets: unable to resolve at least one subnet (0 match VPC and tags: [kubernetes.io/role/elb])
Cause: The subnets are missing the discovery tag (the most common issue in self-built VPCs), or a subnet in an AZ has fewer than 8 available IPs.
aws ec2 describe-subnets --filters Name=vpc-id,Values=$VPC_ID --query "Subnets[].[SubnetId,AvailabilityZone,MapPublicIpOnLaunch,Tags[?Key=='kubernetes.io/role/elb'].Value|[0]]" --output table aws ec2 create-tags --resources subnet-pub1a subnet-pub1b subnet-pub1d --tags Key=kubernetes.io/role/elb,Value=1
Service EXTERNAL-IP stays <pending>
Cause: ① No controller handles the loadBalancerClass (you set service.k8s.aws/nlb but did not install LBC, or you set the LBC class in Auto Mode). ② LBC lacks permissions or is not running. ③ Subnet tag problem.
kubectl -n shop describe svc api-nlb | sed -n '/Events/,$p' kubectl -n kube-system logs deploy/aws-load-balancer-controller --tail=50 | grep -i -E "error|denied"
ALB returns 504 / target group unhealthy: Health checks failed with these codes: [404]
Cause: The health check path is wrong (the default is /), or the security group does not allow traffic from the ALB to the Pod port (common when using a custom SG for Pods).
aws elbv2 describe-target-health --target-group-arn $TG --query "TargetHealthDescriptions[].TargetHealth" kubectl -n shop annotate ingress shop alb.ingress.kubernetes.io/healthcheck-path=/readyz --overwrite
Deleting an Ingress is stuck at Terminating, with finalizer ingress.k8s.aws/resources
Cause: LBC has been deleted or lacks permissions, so it cannot delete the AWS resources, and the finalizer is never removed.
Fix: Restore LBC so it can finish the cleanup (recommended). If you must force-remove the finalizer, manually delete the matching ALB, target groups, and security groups afterward. Otherwise they keep incurring charges and block VPC deletion.
1. Write the Service annotations and fields so that LBC creates a public NLB with IP targets, forwarding TCP 443 to Pod port 8443.
Reference answer
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
spec:
type: LoadBalancer
loadBalancerClass: service.k8s.aws/nlb
ports: [{ port: 443, targetPort: 8443, protocol: TCP }]2. List all load balancers created by Kubernetes in eks-lab (names starting with k8s-).
Reference answer
aws elbv2 describe-load-balancers --query "LoadBalancers[?starts_with(LoadBalancerName,'k8s-')].[LoadBalancerName,Type,Scheme,State.Code]" --output table # More reliable: filter by the tag elbv2.k8s.aws/cluster=eks-lab (aws resourcegroupstaggingapi get-resources --tag-filters Key=elbv2.k8s.aws/cluster,Values=eks-lab)
Scenario analysis: Your team wants to migrate from ingress-nginx to AWS-native ingress. Your 60 Ingresses rely heavily on nginx.ingress.kubernetes.io/rewrite-target. How would you plan this?
Reference answer
ALB does not support arbitrary path rewrites (it supports only limited transforms and redirects), so switching the IngressClass directly would break routing. Plan: ① Inventory the annotations first (ingress2gateway can help with the analysis). ② On the application side, remove the dependency on path prefixes, or route by host instead. ③ If you need complex L7 features (rewrites, rate limiting), keep an in-cluster gateway (a Gateway API implementation such as Envoy Gateway) behind an NLB. ④ For simple routing, use ALB directly (Ingress or the LBC Gateway API), and use IngressGroup to control the number of ALBs. ⑤ For canary rollout, shift traffic gradually with weighted DNS.
Teaching videos
No verified video found. No AWS Load Balancer Controller or Gateway API video with an ID that could be verified via YouTube oEmbed was found. For built-in load balancing in Auto Mode, see the Auto Mode videos listed in module 1.
Official docs
- AWS Load Balancer Controller docs
- LBC · Gateway API
- LBC Releases
- Auto Mode · IngressClass (ALB)
- Auto Mode · Service annotations (NLB)
Video storyboard script
This course file cannot generate video or MP3 directly, so a storyboard and narration script are provided instead.
Narration: On EKS, one Ingress object becomes a real application load balancer.
Narration: The load balancer controller watches Ingress objects, calls the ELB APIs to create each resource, and writes the address back to the Ingress status.
Narration: Because Pods have VPC addresses, IP mode skips one hop. Combined with readiness gates, it also avoids dropped requests during rollouts.
Narration: Delete the Ingress and the load balancer Service first, then delete the cluster. Otherwise the load balancers become orphaned resources.
Module 5 · Storage and Secrets: EBS / EFS CSI, Secrets Manager
- Write a gp3 StorageClass for EBS CSI, and explain why
WaitForFirstConsumerand AZ topology are critical for EBS. - Know that the Auto Mode block storage provisioner is
ebs.csi.eks.amazonaws.com, and that you must create the StorageClass yourself. - Use EFS CSI dynamic provisioning (access points) to provide ReadWriteMany volumes.
- Use the Secrets Store CSI Driver with the AWS provider (ASCP) or External Secrets Operator to read from Secrets Manager, with Pod Identity for authentication.
What: three kinds of storage on EKS
| Type | CSI driver / provisioner | Access mode | Scope | Typical use |
|---|---|---|---|---|
| Amazon EBS | Managed add-on aws-ebs-csi-driver → ebs.csi.aws.com; Auto Mode → ebs.csi.eks.amazonaws.com | RWO (io2 supports multi-attach, for special cases) | Single AZ | Databases, StatefulSets |
| Amazon EFS | Managed add-on aws-efs-csi-driver → efs.csi.aws.com | RWX | Multi-AZ within a region | Shared upload directories, CMS, ML datasets |
| FSx (Lustre / NetApp ONTAP / OpenZFS), S3 Mountpoint CSI | Each product's own CSI add-on | Depends on the product | Depends on the product | HPC, big data (not covered in this hour) |
Why: the EBS availability zone constraint
An EBS volume can only be attached to EC2 instances in the same AZ. If the StorageClass uses Immediate, the volume is created in some AZ as soon as the PVC is created. The Pod may later be scheduled onto a node in another AZ, and then it can never attach. WaitForFirstConsumer lets the scheduler choose the node first, and then CSI creates the volume based on the node's topology.kubernetes.io/zone. After that, the PV carries a nodeAffinity, so when the Pod is recreated it can only be scheduled into that AZ. That means that AZ must have available capacity (Karpenter and Auto Mode launch nodes in that AZ on demand; Cluster Autoscaler needs one node group per AZ).
How: dynamic provisioning and reading secrets
- EBS dynamic provisioning: PVC → external-provisioner calls CSI
CreateVolume→ EC2CreateVolume(gp3, per AZ) → after the Pod is scheduled, external-attacher callsAttachVolume→ the node plugin formats and mounts the volume. The volume ID is recorded in the PV'svolumeHandle. - gp3: baseline of 3000 IOPS and 125 MiB/s, which can be raised independently (StorageClass parameters
iopsandthroughput), and it costs less than gp2. UseVolumeAttributesClass(GA since K8s 1.34) to change type, IOPS, and throughput online. - EFS dynamic provisioning: The EFS file system must be created in advance, with a mount target in each AZ and a security group that allows NFS 2049. The StorageClass
provisioningMode: efs-apcreates one EFS access point per PVC, with its own directory and POSIX identity. - Secrets Store CSI Driver + ASCP: The Pod mounts a CSI volume. The driver calls the AWS provider, which uses the Pod's identity (
usePodIdentity: "true"or IRSA) to call Secrets ManagerGetSecretValue, and writes the secret as a tmpfs file inside the Pod. Optionally, it syncs to a K8s Secret (secretObjects). - External Secrets Operator (ESO): The controller reads Secrets Manager with its own identity, then generates and periodically refreshes a K8s Secret. This suits environment variable injection or GitOps scenarios (hour 6).
When: storage differences in Auto Mode
| Item | Managed EBS CSI add-on | Auto Mode block storage |
|---|---|---|
| provisioner | ebs.csi.aws.com | ebs.csi.eks.amazonaws.com |
| StorageClass | The add-on does not create a gp3 default class (older clusters may have an in-tree gp2 default class) | Does not create any StorageClass. You must create one. It is recommended to restrict it with allowedTopologies to eks.amazonaws.com/compute-type: auto |
| Controller | In-cluster Deployment (requires IAM: Pod Identity / IRSA) | AWS-managed (cluster IAM role) |
| Limits | - | Can only attach to Auto Mode nodes. Does not support node startup taints, the extra-tags parameter, or detailed performance metrics. Static provisioning requires tagging the volume with eks:eks-cluster-name. Annotation-based volume modification (volume-modifier-for-k8s) is no longer supported after 2026-10-31; use VolumeAttributesClass instead. |
| EFS | Auto Mode does not include EFS built in, so you still need to install the EFS CSI add-on | |
Comparison with AKS
| Dimension | EKS | AKS |
|---|---|---|
| Cross-AZ block storage | EBS is single-AZ only (rely on application replication or restore from snapshots) | Azure Disk has ZRS (zone-redundant storage) |
| Shared files | EFS (NFS) | Azure Files (SMB/NFS) |
| Secrets | Secrets Manager / Parameter Store + ASCP or ESO | Key Vault + Secrets Store CSI add-on |
EBS volume and AZ topology (WaitForFirstConsumer)
Secrets Manager → Pod (ASCP + Pod Identity)
Step-by-step animation: how a PVC becomes an EBS volume
Compare the WaitForFirstConsumer and Immediate binding modes.
Command reference
| Command / object | Purpose | Key parameters |
|---|---|---|
aws eks create-addon --addon-name aws-ebs-csi-driver | Install the EBS CSI managed add-on (non-Auto Mode) | --pod-identity-associations or --service-account-role-arn |
StorageClass gp3 | Dynamic EBS provisioning | type, encrypted, kmsKeyId, iops, throughput |
kubectl get pv -o custom-columns=…volumeHandle…nodeAffinity | View the volume ID and AZ | - |
aws ec2 describe-volumes --filters Name=tag:kubernetes.io/created-for/pvc/name,Values=… | Find a PVC's volume from the AWS side | Auto Mode volumes carry eks:eks-cluster-name |
aws eks create-addon --addon-name aws-efs-csi-driver | Install EFS CSI | Requires an IAM role |
SecretProviderClass (secrets-store.csi.x-k8s.io/v1) | Declares the secrets to mount | provider: aws, objects, usePodIdentity |
VolumeAttributesClass (storage.k8s.io/v1) | Change EBS type / IOPS / throughput online | driverName, parameters |
1. gp3 StorageClass (two variants)
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp3
annotations: { storageclass.kubernetes.io/is-default-class: "true" }
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
reclaimPolicy: Delete
parameters:
type: gp3
encrypted: "true"
# iops: "6000"
# throughput: "250"
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: auto-ebs-sc
annotations: { storageclass.kubernetes.io/is-default-class: "true" }
allowedTopologies:
- matchLabelExpressions:
- key: eks.amazonaws.com/compute-type
values: ["auto"]
provisioner: ebs.csi.eks.amazonaws.com
volumeBindingMode: WaitForFirstConsumer
parameters:
type: gp3
encrypted: "true"
Common error: The cluster has two StorageClasses both marked is-default-class: "true" (older clusters come with gp2), so PVCs that do not specify a class behave unpredictably. Remove the default annotation from gp2.
2. EBS CSI managed add-on + Pod Identity (eks-mng)
aws iam create-role --role-name eks-mng-ebs-csi --assume-role-policy-document file://trust.json # Pod Identity trust policy from M3 aws iam attach-role-policy --role-name eks-mng-ebs-csi --policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy aws eks create-addon --cluster-name eks-mng --addon-name aws-ebs-csi-driver \ --pod-identity-associations serviceAccount=ebs-csi-controller-sa,roleArn=arn:aws:iam::$ACCT:role/eks-mng-ebs-csi aws eks wait addon-active --cluster-name eks-mng --addon-name aws-ebs-csi-driver kubectl -n kube-system get pods -l app.kubernetes.io/name=aws-ebs-csi-driver
If the eks-mng.yaml from module 0 uses useDefaultPodIdentityAssociations: true, eksctl completes the steps above automatically.
3. Change IOPS online (VolumeAttributesClass)
apiVersion: storage.k8s.io/v1
kind: VolumeAttributesClass
metadata: { name: gp3-6000-250 }
driverName: ebs.csi.eks.amazonaws.com # a self-installed driver uses ebs.csi.aws.com
parameters: { type: gp3, iops: "6000", throughput: "250" }
kubectl -n shop patch pvc data-db-0 --type=merge -p '{"spec":{"volumeAttributesClassName":"gp3-6000-250"}}'
kubectl -n shop get pvc data-db-0 -o custom-columns=REQ:.spec.volumeAttributesClassName,CUR:.status.currentVolumeAttributesClassName
4. EFS dynamic provisioning (RWX)
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata: { name: efs }
provisioner: efs.csi.aws.com
parameters:
provisioningMode: efs-ap
fileSystemId: fs-0123456789abcdef0
directoryPerms: "700"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: uploads, namespace: shop }
spec:
accessModes: ["ReadWriteMany"]
storageClassName: efs
resources: { requests: { storage: 5Gi } } # EFS scales elastically; this value does not limit capacity
5. Secrets Manager → Pod (ASCP)
helm repo add secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts
helm repo add aws-secrets-manager https://aws.github.io/secrets-store-csi-driver-provider-aws
helm upgrade --install csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver -n kube-system \
--set syncSecret.enabled=true --set enableSecretRotation=true
helm upgrade --install secrets-provider-aws aws-secrets-manager/secrets-store-csi-driver-provider-aws -n kube-system
aws secretsmanager create-secret --name shop/db --secret-string '{"username":"shop","password":"S3cure-Lab-Only"}'
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata: { name: shop-db, namespace: shop }
spec:
provider: aws
parameters:
usePodIdentity: "true"
objects: |
- objectName: "shop/db"
objectType: "secretsmanager"
jmesPath:
- { path: "password", objectAlias: "db-password" }
secretObjects: # optional: sync to a K8s Secret for use as env vars
- secretName: shop-db
type: Opaque
data: [{ objectName: db-password, key: password }]
ASCP is also available as an EKS add-on; follow the AWS docs for installation. The Pod's role needs secretsmanager:GetSecretValue and secretsmanager:DescribeSecret (scoped to arn:aws:secretsmanager:ca-central-1:ACCT:secret:shop/db-*). If you use a customer-managed KMS key, you also need kms:Decrypt.
Lab 5: shop db uses a gp3 persistent volume and reads its password from Secrets Manager (about 15 minutes)
sc-auto-gp3.yaml. In eks-mng, apply sc-gp3.yaml.apiVersion: apps/v1
kind: StatefulSet
metadata: { name: db, namespace: shop }
spec:
serviceName: db
replicas: 1
selector: { matchLabels: { app: db } }
template:
metadata: { labels: { app: db } }
spec:
serviceAccountName: api # reuses the M3 Pod Identity association (a dedicated SA for db is cleaner)
containers:
- name: postgres
image: postgres:17
env:
- { name: POSTGRES_USER, value: shop }
- { name: POSTGRES_PASSWORD_FILE, value: /mnt/secrets/db-password }
- { name: PGDATA, value: /var/lib/postgresql/data/pgdata }
ports: [{ containerPort: 5432 }]
resources: { requests: { cpu: 250m, memory: 512Mi } }
volumeMounts:
- { name: data, mountPath: /var/lib/postgresql/data }
- { name: secrets, mountPath: /mnt/secrets, readOnly: true }
volumes:
- name: secrets
csi: { driver: secrets-store.csi.k8s.io, readOnly: true, volumeAttributes: { secretProviderClass: shop-db } }
volumeClaimTemplates:
- metadata: { name: data }
spec:
accessModes: ["ReadWriteOnce"]
resources: { requests: { storage: 20Gi } }
kubectl apply -f spc-shop-db.yaml -f db.yaml # first add secretsmanager:GetSecretValue to the shop-api-s3-read role (or create a new db role) kubectl -n shop get pvc -w
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE data-db-0 Pending auto-ebs-sc 2s data-db-0 Bound pvc-6f1c… 20Gi RWO auto-ebs-sc 25s
kubectl get pv $(kubectl -n shop get pvc data-db-0 -o jsonpath='{.spec.volumeName}') \
-o jsonpath='{.spec.csi.volumeHandle}{" "}{.spec.nodeAffinity.required.nodeSelectorTerms[0].matchExpressions[0].values}{"\n"}'
kubectl -n shop get pod db-0 -o wide; kubectl get node $(kubectl -n shop get pod db-0 -o jsonpath='{.spec.nodeName}') -L topology.kubernetes.io/zonekubectl -n shop exec db-0 -- psql -U shop -c "create table t(x int); insert into t values (42);" kubectl -n shop delete pod db-0 && kubectl -n shop wait --for=condition=Ready pod/db-0 --timeout=180s kubectl -n shop exec db-0 -- psql -U shop -tc "select * from t;" # still 42, and the Pod is still in the same AZ
kubectl -n shop delete sts db. PVCs are not deleted with the StatefulSet. After kubectl -n shop delete pvc data-db-0, confirm that no leftover volumes remain in the output of aws ec2 describe-volumes --filters Name=status,Values=available. Then run aws secretsmanager delete-secret --secret-id shop/db --force-delete-without-recovery (lab environment only).Case 1: The database is unavailable during an AZ failure
Problem: The EBS volume for the single-replica Postgres is in 1a. During the 1a failure, the Pod stays Pending (volume node affinity conflict). Fix: Migrate critical databases to multi-AZ RDS or Aurora. If you must self-manage, use an operator (such as CloudNativePG) for cross-AZ primary/replica, with a separate EBS volume per replica. Also schedule snapshots with AWS Backup or VolumeSnapshot. Limit: EBS has no cross-AZ synchronous replication. This is the fundamental difference from Azure ZRS disks.
Case 2: Migrating existing volumes to Auto Mode
The old cluster's PVCs use ebs.csi.aws.com, which the Auto Mode driver cannot take over. Fix: VolumeSnapshot → restore in the new cluster from the snapshot using an Auto Mode StorageClass (or create a static PV that references the volume ID and tag it with eks:eks-cluster-name). Stop writes during the migration window.
Case 3: Plaintext passwords in config files
An audit found database passwords in Helm values. Move them to Secrets Manager with automatic rotation (a Lambda rotation function). Applications read the file through ASCP and reconnect when the file changes. The GitOps repo stores only the SecretProviderClass.
Common errors and fixes
0/3 nodes are available: 1 node(s) had volume node affinity conflict, 2 node(s) didn't match Pod's node affinity/selector
Cause: No schedulable node exists in the PV's AZ (deleted, insufficient capacity, or the NodePool excludes that AZ), or the StorageClass uses Immediate.
kubectl get pv PV -o jsonpath='{.spec.nodeAffinity}'
kubectl get nodes -L topology.kubernetes.io/zone
kubectl get sc -o custom-columns=N:.metadata.name,MODE:.volumeBindingMode
Fix: Make sure the AZ has nodes (do not exclude that AZ in your Karpenter or Auto Mode NodePool; CA needs one node group per AZ). Change the StorageClass to WaitForFirstConsumer (this only affects new PVCs).
PVC Pending: waiting for a volume to be created either by the external provisioner 'ebs.csi.aws.com' or manually by the system administrator
Cause: Under WaitForFirstConsumer, no Pod is using the PVC yet (this is normal). Or the EBS CSI controller is not installed or lacks IAM permissions. Or ebs.csi.aws.com is used in an Auto Mode cluster, where no matching driver exists.
kubectl get csidrivers kubectl -n kube-system logs deploy/ebs-csi-controller -c csi-provisioner --tail=30 # non-Auto Mode kubectl describe pvc PVC | sed -n '/Events/,$p'
Multi-Attach error for volume "pvc-…" Volume is already exclusively attached to one node and can't be attached to another
Cause: The RWO volume is still attached to an old node (the node shut down uncleanly, or during a Deployment rollout the old and new Pods both need the volume).
Fix: Use a StatefulSet for stateful apps, or a Deployment with strategy: Recreate. If the node is already unavailable, wait for the attach-detach controller to force-detach the volume after its timeout (about 6 minutes), or delete the VolumeAttachment after confirming the node is terminated.
MountVolume.SetUp failed for volume "secrets" : rpc error: … AccessDeniedException: … is not authorized to perform: secretsmanager:GetSecretValue
Cause: The Pod's role lacks permissions, or the resource ARN is wrong (a Secrets Manager ARN ends with 6 random characters, so write shop/db-*), or usePodIdentity: "true" is not set, so ASCP took the IRSA path.
kubectl -n shop describe pod db-0 | sed -n '/Events/,$p' kubectl -n kube-system logs ds/secrets-provider-aws-secrets-store-csi-driver-provider-aws --tail=30
1. Find all EBS volumes in the available (unattached) state that were created by this cluster's CSI driver.
Reference answer
aws ec2 describe-volumes --filters Name=status,Values=available Name=tag-key,Values=kubernetes.io/created-for/pvc/name \ --query "Volumes[].[VolumeId,AvailabilityZone,Size,Tags[?Key=='kubernetes.io/created-for/pvc/name'].Value|[0]]" --output table
2. Expand PVC data-db-0 from 20Gi to 40Gi, and explain the prerequisites.
Reference answer
kubectl -n shop patch pvc data-db-0 -p '{"spec":{"resources":{"requests":{"storage":"40Gi"}}}}'Prerequisites: the StorageClass needs allowVolumeExpansion: true. EBS has a cooldown of about 6 hours between two modifications of the same volume. The file system is expanded online by the CSI node plugin.
Scenario analysis: The CMS needs 3 replicas to share an upload directory, deployed across 3 AZs. Should you choose EBS or EFS? What else should you watch out for?
Reference answer
EFS (RWX, regional, with mount targets in multiple AZs). Notes: every AZ needs a mount target, and the security group must allow port 2049. Use efs-ap dynamic access points to isolate directories and UIDs. Choose Elastic throughput mode. Performance for metadata-heavy operations on many small files is limited, so you can put a CDN in front (serving static files from S3 + CloudFront is better). Auto Mode also requires installing the EFS CSI add-on separately.
Teaching videos
No verified video found. No official EBS / EFS CSI or ASCP video with an ID that could be verified via YouTube oEmbed was found.
Official docs
- Amazon EBS CSI driver
- Auto Mode · Create a storage class
- Amazon EFS CSI driver
- Secrets Manager · ASCP
- VolumeAttributesClass
Video storyboard script
This course file cannot generate video or MP3 directly, so a storyboard and narration script are provided instead.
Narration: An EBS volume belongs to one availability zone. For a Pod to use it, the Pod must run in that same zone.
Narration: Wait-for-first-consumer mode lets the scheduler pick the node first, and then the volume is created in that node's zone.
Narration: When several replicas need to share the same directory, use EFS. It is a regional network file system.
Narration: Secrets stay in Secrets Manager. The Pod reads them on demand with its own identity, and they never go into images or Git.
Module 6 · Autoscaling and Cost: Karpenter, Auto Mode, Spot
- Explain Karpenter's provisioning loop: watch unschedulable Pods → batch → compute constraints → create a NodeClaim → EC2 CreateFleet → node registration.
- Write a NodePool (
karpenter.sh/v1) and an EC2NodeClass (karpenter.k8s.aws/v1). Know that Auto Mode uses a NodeClass (eks.amazonaws.com/v1). - Understand disruption: consolidation (
WhenEmptyOrUnderutilized/WhenEmpty), drift, expiration, budgets, and Spot interruption handling (SQS + EventBridge). - Compare with Cluster Autoscaler, and list the EKS cost optimization checklist.
What: Karpenter
Karpenter is an open-source node lifecycle manager under the CNCF (started by AWS; AKS NAP is also based on it). It does not manage node groups. Instead, based on the resource requests of pending Pods, their nodeSelector or affinity, topology spread, and taint tolerations, it picks instance types, purchase options (Spot or on-demand), and AZs within what the NodePool allows, then calls EC2 CreateFleet to launch the instances. Core objects:
| Object | API | Purpose |
|---|---|---|
| NodePool | karpenter.sh/v1 | “What kinds of nodes can be created”: requirements (instance category, architecture, capacity-type, AZ), limits (total CPU and memory caps), disruption (consolidation policy, budgets), taints, expireAfter, weight |
| EC2NodeClass | karpenter.k8s.aws/v1 | “How nodes land on AWS”: AMI (amiSelectorTerms, for example alias: al2023@latest), subnet and security group selectors, IAM role, block devices, IMDS, userData |
| NodeClaim | karpenter.sh/v1 | A node request created by Karpenter, corresponding to one EC2 instance. States: Launched → Registered → Initialized |
| NodeClass (Auto Mode) | eks.amazonaws.com/v1 | In Auto Mode, replaces EC2NodeClass with fewer fields (subnets, security groups, ephemeral storage, network policies, and so on). AWS manages the AMI. |
Why: compared with Cluster Autoscaler
| Dimension | Cluster Autoscaler (CA) | Karpenter / Auto Mode |
|---|---|---|
| Scale-out unit | Increase the desired count of the node group (ASG) by +1 | Creates instances directly (CreateFleet), without going through an ASG |
| Instance types | Fixed per node group (or a mixed-instances policy) | Picks the cheapest type that meets the constraints from dozens or hundreds of types, on demand |
| Speed | Scan interval + ASG scale-out | Second-level batching, launches directly |
| Scale-in / consolidation | Removes only underutilized nodes | Removes empty nodes and replaces nodes with cheaper instances (consolidation) |
| AZ and EBS | One node group per AZ is needed to handle EBS affinity correctly | Understands volume topology and automatically launches nodes in the right AZ |
| Spot | Needs Node Termination Handler | Built-in interruption handling (SQS queue) |
How: provisioning and disruption
- Provisioning: The scheduler marks the Pod as
PodScheduled=False / Unschedulable→ Karpenter batches these Pods within a short time window → simulates scheduling (considering existing nodes, DaemonSet overhead, and topology) → creates NodeClaims for the NodePool (listing several candidate instance types) → EC2 CreateFleet (Spot uses the price-capacity-optimized strategy) → the node starts with the AMI and userData from the EC2NodeClass, and kubelet registers it → the scheduler places the Pod on it. - Disruption, set in the NodePool's
spec.disruption:consolidationPolicy:WhenEmptyOrUnderutilized(default: empty nodes are deleted, and underutilized nodes are replaced with smaller or cheaper ones, or merged),WhenEmpty(only deletes empty nodes). The v1.15 docs also listBalanced.consolidateAfter(default 0s;Neverturns it off).- Drift: When the NodePool requirements or the EC2NodeClass's AMI, subnet, or security group selectors change, nodes are marked Drifted and replaced in a rolling fashion. This is how AMI upgrades are applied.
- Expiration:
spec.template.spec.expireAfter(default 720h) forces rotation. - Budgets:
budgets: [{nodes: "10%"}](10% by default if not set). You can scope windows by reason (Drifted, Underutilized, Empty), and with a cronschedule+duration. All disruptions go through the Eviction API and respect PDBs and thekarpenter.sh/do-not-disruptannotation.
- Spot interruption: EC2 sends a 2-minute Spot interruption warning → EventBridge rule → SQS queue → Karpenter (
--interruption-queue/ Helmsettings.interruptionQueue) immediately starts a replacement node, taints the node being reclaimed, and evicts its Pods. It also handles scheduled maintenance, instance stop or termination, and status check failure events. Rebalance recommendations are only recorded as events, with no action taken.
When: Karpenter managed by Auto Mode
In Auto Mode, AWS runs Karpenter on the control plane side. You do not install the Helm chart, create an interruption queue, or manage the Karpenter version. You still write NodePools (nodeClassRef.group: eks.amazonaws.com). Instance selection labels include eks.amazonaws.com/instance-category, eks.amazonaws.com/instance-generation, and so on. Built-in NodePools: general-purpose (on-demand c, m, and r series) and system (with the CriticalAddonsOnly taint). Create a new NodePool when you need Spot, GPU, or arm64.
EKS cost optimization checklist
- Keep requests close to real usage (VPA recommendations or Container Insights). Otherwise Karpenter will buy machines for inflated requests.
- Use Spot for stateless, interruptible workloads. The NodePool allows both spot and on-demand, and Karpenter prefers Spot. Broaden instance types as much as possible (≥ 15 types) to reduce the interruption rate.
- Turn on consolidation, and control its pace with PDBs and budgets. Use budget windows at night.
- Graviton (arm64) is usually more cost-effective: use multi-architecture images (covered in the Docker course) and a NodePool that allows arm64.
- Compute Savings Plans cover the steady baseline (applies to EC2 and Fargate, under AWS pricing rules).
- Network costs: cross-AZ traffic is charged. Use topology-aware routing (
trafficDistribution: PreferClose), and VPC endpoints for ECR and S3 to avoid NAT Gateway data processing fees. - Upgrade in a timely way to avoid the control plane surcharge for clusters in extended support (M7).
- Use cost allocation tags or Split Cost Allocation Data to allocate costs by namespace.
Karpenter provisioning loop
Consolidation before and after
Interactive simulator: Karpenter provisioning, consolidation, and Spot interruption
Click the buttons to change the load and watch NodeClaims being created, consolidated, and reclaimed on Spot. Each log line corresponds to a real event or API call.
Command reference
| Command / object | Purpose | Key parameters |
|---|---|---|
kubectl get nodepools,nodeclaims -o wide | View the NodePool and each node's NodeClaim | Common to Auto Mode and self-managed Karpenter |
kubectl get ec2nodeclasses / kubectl get nodeclasses | Node class (self-managed / Auto Mode) | - |
helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter | Install Karpenter (non-Auto Mode) | --version 1.15.2, settings.clusterName, settings.interruptionQueue |
kubectl annotate pod P karpenter.sh/do-not-disrupt=true | Prevents the node this Pod runs on from being proactively disrupted | Long-running jobs |
kubectl get events -A --field-selector source=karpenter | Provisioning and interruption events | - |
kubectl -n kube-system logs deploy/karpenter | Controller logs (self-managed) | | grep -E "launched|disrupt" |
1. Auto Mode: add a Spot + arm64 NodePool
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: spot-flex
spec:
template:
spec:
nodeClassRef:
group: eks.amazonaws.com
kind: NodeClass
name: default
requirements:
- { key: karpenter.sh/capacity-type, operator: In, values: ["spot", "on-demand"] }
- { key: kubernetes.io/arch, operator: In, values: ["amd64", "arm64"] }
- { key: eks.amazonaws.com/instance-category, operator: In, values: ["c", "m", "r"] }
- { key: eks.amazonaws.com/instance-generation, operator: Gt, values: ["5"] }
expireAfter: 336h
limits:
cpu: "32"
memory: 128Gi
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
budgets:
- nodes: "20%"
- nodes: "0"
schedule: "0 13 * * mon-fri" # no voluntary disruption for 4 hours starting at 13:00 UTC (Toronto morning)
duration: 4h
reasons: ["Underutilized", "Drifted"]
weight: 10
How to verify: kubectl get nodepool spot-flex shows READY=True. After you deploy a workload with nodeSelector: {karpenter.sh/nodepool: spot-flex}, run kubectl get nodeclaims -L karpenter.sh/capacity-type,kubernetes.io/arch. Common error: the image is not multi-architecture, which causes exec format error on arm64 nodes (the podinfo and official nginx images are both multi-architecture).
2. Self-managed Karpenter (eks-mng branch, outline)
export KARPENTER_VERSION=1.15.2 CLUSTER_NAME=eks-mng # 1) Deploy the CloudFormation template from the official Karpenter Getting Started guide: node role, controller IAM policy, SQS interruption queue, and EventBridge rules # 2) Use Pod Identity for the controller identity (kube-system/karpenter); create an access entry for the node role (type EC2_LINUX) aws eks create-access-entry --cluster-name $CLUSTER_NAME --principal-arn arn:aws:iam::$ACCT:role/KarpenterNodeRole-$CLUSTER_NAME --type EC2_LINUX # 3) Tag the private subnets and the node security group for discovery aws ec2 create-tags --resources subnet-priv1a subnet-priv1b subnet-priv1d sg-node --tags Key=karpenter.sh/discovery,Value=$CLUSTER_NAME # 4) Install the chart helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter --version $KARPENTER_VERSION \ -n kube-system --set settings.clusterName=$CLUSTER_NAME --set settings.interruptionQueue=$CLUSTER_NAME \ --set controller.resources.requests.cpu=1 --set controller.resources.requests.memory=1Gi --wait
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata: { name: default }
spec:
role: KarpenterNodeRole-eks-mng
amiSelectorTerms:
- alias: al2023@latest # in production, pin a version such as al2023@v2026xxxx, then upgrade it in a controlled way through drift
subnetSelectorTerms:
- tags: { karpenter.sh/discovery: eks-mng }
securityGroupSelectorTerms:
- tags: { karpenter.sh/discovery: eks-mng }
metadataOptions: { httpTokens: required, httpPutResponseHopLimit: 1 }
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata: { name: default }
spec:
template:
spec:
nodeClassRef: { group: karpenter.k8s.aws, kind: EC2NodeClass, name: default }
requirements:
- { key: karpenter.sh/capacity-type, operator: In, values: ["spot", "on-demand"] }
- { key: karpenter.k8s.aws/instance-category, operator: In, values: ["c", "m", "r"] }
- { key: karpenter.k8s.aws/instance-generation, operator: Gt, values: ["5"] }
limits: { cpu: "64" }
disruption: { consolidationPolicy: WhenEmptyOrUnderutilized, consolidateAfter: 1m }
Run the Karpenter controller itself on nodes it does not manage (put it on a managed node group or Fargate). For the complete IAM and CloudFormation templates, refer to the karpenter.sh Getting Started guide.
3. Observe provisioning and consolidation
kubectl get nodeclaims -w -o custom-columns=NAME:.metadata.name,TYPE:.metadata.labels.node\\.kubernetes\\.io/instance-type,CAP:.metadata.labels.karpenter\\.sh/capacity-type,ZONE:.metadata.labels.topology\\.kubernetes\\.io/zone,READY:.status.conditions[?(@.type==\"Ready\")].status kubectl get events -A --field-selector source=karpenter --sort-by=.lastTimestamp | tail -20
NAME TYPE CAP ZONE READY spot-flex-8m2qv c7g.xlarge spot ca-central-1d True ... Normal DisruptionLaunching nodeclaim/spot-flex-x7k1z Launching NodeClaim: Underutilized/Replace Normal DisruptionTerminating node/i-0abc… Disrupting Node: Underutilized/Replace
Lab 6: Trigger scale-out with a load test, then watch consolidation reclaim nodes (about 20 minutes; nodes are billed by the second)
kubectl -n shop set resources deploy/api --requests=cpu=500m,memory=128Mi --limits=memory=256Mi kubectl -n shop autoscale deploy api --cpu-percent=60 --min=2 --max=20 kubectl -n shop get hpa api
Does Auto Mode include metrics-server built in? Check the actual cluster with kubectl get apiservice v1beta1.metrics.k8s.io. If it does not exist, install the EKS community add-on metrics-server or a Helm chart.
kubectl apply -f np-spot.yaml
kubectl -n shop patch deploy api -p '{"spec":{"template":{"spec":{"nodeSelector":{"karpenter.sh/nodepool":"spot-flex"}}}}}'kubectl -n shop run load --image=ghcr.io/stefanprodan/podinfo:6.17.0 --restart=Never --command -- \ sh -c 'for i in $(seq 1 16); do (while true; do wget -q -O- http://api:9898/ >/dev/null 2>&1; done) & done; sleep 900' kubectl -n shop get hpa api -w # in another terminal: kubectl get nodeclaims -w
If the load is not enough, temporarily lower api's CPU requests (for example to 100m), or use the hey load-testing method from hour 6. The goal is to make the HPA scale out Pods that the existing nodes cannot fit.
kubectl -n shop delete pod load # About 5 minutes later the HPA scales in (default scale-down stabilization window of 300s), and after consolidateAfter the nodes are consolidated or deleted kubectl get events -A --field-selector source=karpenter -w
kubectl -n shop delete hpa api; kubectl -n shop scale deploy/api --replicas=2. Keep or delete the spot-flex NodePool (deleting a NodePool terminates all the nodes it created).Case 1: Migrating from 8 node groups + CA to Karpenter cut compute costs by about 35%
Approach: Keep a small managed node group to run Karpenter and system components. Move business workloads to two NodePools (general on-demand, plus interruptible spot). Broaden instance types to c, m, and r families from generation 6 and newer, plus Graviton. Turn on WhenEmptyOrUnderutilized. Pitfall: Many single-replica services had no PDBs early on, so consolidation caused brief outages. Before go-live, require every Deployment to have ≥ 2 replicas plus a PDB (hour 6).
Case 2: AMI upgrades become a controlled drift
EC2NodeClass pins al2023@vYYYYMMDD. Each month, the platform team switches to the new version in the staging cluster → Karpenter detects the drift and replaces nodes in a rolling fashion, within the budgets (20% outside working hours) → after a week of observation, roll it out to production. This is far more controllable than manually rotating node groups.
Case 3: Long batch jobs interrupted by consolidation
A 3-hour Spark executor was evicted by consolidation. Fix: add karpenter.sh/do-not-disrupt: "true" to the batch Pods, and use a batch-only NodePool with consolidationPolicy: WhenEmpty. Spot interruptions still happen, so jobs must support retries or checkpoints.
Common errors and fixes
Pod stays Pending. Karpenter event: could not schedule pod, incompatible with nodepool "default", … no instance type satisfied resources {"cpu":"…"} and requirements …
Cause: The Pod's requests exceed the largest instance the NodePool allows, or its nodeSelector or affinity (such as arch or zone) does not intersect with the NodePool requirements, or the NodePool limits are already full.
kubectl describe pod P | sed -n '/Events/,$p'
kubectl get nodepool default -o jsonpath='{.status.resources}{"\n"}{.spec.limits}'NodeClaim stays Launched but not Registered (the node does not join the cluster)
Cause: The node role has no access entry (most common with self-managed Karpenter), the subnet cannot reach the EKS endpoint or ECR (no NAT and no VPC endpoints), the security group does not allow communication with the control plane, or userData is wrong.
kubectl describe nodeclaim NC | sed -n '/Status/,$p' aws eks list-access-entries --cluster-name eks-mng | grep -i karpenter aws ec2 get-console-output --instance-id i-… --latest --output text | tail -40
Nodes are replaced frequently, with events repeatedly showing Disrupting Node: Underutilized/Replace
Cause: consolidateAfter is too short and the load fluctuates. HPA oscillation causes repeated scale-out and scale-in.
Fix: Increase consolidateAfter (for example to 10m), configure budget windows, and check the HPA behavior settings (hour 6). Set PDBs for critical workloads.
When a Spot node is reclaimed, its Pods disappear without advance eviction
Cause: The self-managed Karpenter has no interruption queue configured (settings.interruptionQueue is empty, or the EventBridge rule or SQS policy is missing), or aws-node-termination-handler runs alongside Karpenter and both try to handle the same events.
helm -n kube-system get values karpenter | grep -i interruption aws sqs get-queue-attributes --queue-url $(aws sqs get-queue-url --queue-name eks-mng --query QueueUrl --output text) --attribute-names ApproximateNumberOfMessages
1. Write a NodePool snippet that allows only the GPU instance category g, on-demand, with the taint nvidia.com/gpu=true:NoSchedule (Auto Mode).
Reference answer
apiVersion: karpenter.sh/v1
kind: NodePool
metadata: { name: gpu }
spec:
template:
spec:
nodeClassRef: { group: eks.amazonaws.com, kind: NodeClass, name: default }
requirements:
- { key: eks.amazonaws.com/instance-category, operator: In, values: ["g"] }
- { key: karpenter.sh/capacity-type, operator: In, values: ["on-demand"] }
taints:
- { key: nvidia.com/gpu, value: "true", effect: NoSchedule }
limits: { nvidia.com/gpu: 4 }2. Make a Job's Pods not be interrupted by consolidation while they are running.
Reference answer
spec:
template:
metadata:
annotations:
karpenter.sh/do-not-disrupt: "true"Scenario analysis: Finance requires the dev cluster's overnight cost to be close to zero, but EKS has no az aks stop. What would you do?
Reference answer
The control plane cannot be stopped (it still charges USD 0.10/hour). Data plane: scale non-system Deployments to 0 overnight (with a KEDA cron scaler, or a CronJob that calls kubectl scale), and Karpenter or Auto Mode will delete the empty nodes automatically. For managed node groups, you can set min and desired to 0. If the cluster is not used at night at all, rebuilding it on demand (IaC + GitOps, restorable within 30 minutes) is cheaper than keeping it running. Also clean up idle load balancers and NAT gateways, since NAT is billed hourly too.
Teaching video (title and channel verified via YouTube oEmbed on 2026-11-15)
No Karpenter video with a verifiable ID was found. The re:Invent 2024 session KUB312, “Simplify Kubernetes workloads with Karpenter & Amazon EKS Auto Mode,” appears in a third-party index, but its YouTube ID could not be retrieved and verified, so no link is listed.
Official docs
- Karpenter docs (v1.15)
- Disruption
- karpenter-provider-aws Releases
- Auto Mode · Create a NodePool
- Best Practices · Karpenter
- Best Practices · Cost optimization
Video storyboard script
This course file cannot generate video or MP3 directly, so a storyboard and narration script are provided instead.
Narration: Karpenter does not scale node groups. Instead, based on what the pending Pods need, it picks the one instance that fits best and costs the least.
Narration: Consolidation keeps compressing the cluster into a cheaper shape, but it always respects PodDisruptionBudgets and disruption budgets.
Narration: The Spot interruption event enters the queue, and Karpenter replaces the node early so the Pods move over smoothly.
Narration: Sensible resource requests, broader instance types, Spot and Graviton, and timely upgrades are the most effective ways to save money on EKS.
Module 7 · Upgrades and Operations: Version Windows, Managed Add-ons, Observability
- Read the EKS version calendar: each minor version gets 14 months of standard support plus 12 months of extended support. 1.37 was released on EKS on 2026-10-01.
- Use cluster insights (upgrade insights) for pre-upgrade checks. Upgrade in this order: control plane → managed add-ons → nodes, and upgrade only one minor version at a time.
- Manage version compatibility and configuration for EKS managed add-ons (vpc-cni, coredns, kube-proxy, eks-pod-identity-agent, aws-ebs-csi-driver).
- Enable CloudWatch Container Insights (the
amazon-cloudwatch-observabilityadd-on) and Amazon Managed Service for Prometheus.
What: EKS version calendar (docs.aws.amazon.com, verified on 2026-11-15)
| Version | Upstream release | EKS release | Standard support ends | Extended support ends | Current status |
|---|---|---|---|---|---|
| 1.37 | 2026-08-26 | 2026-10-01 | 2027-12-01 | 2028-12-01 | Standard support |
| 1.36 | 2026-04-22 | 2026-06-02 | 2027-08-02 | 2028-08-02 | Standard support |
| 1.35 | 2025-12-17 | 2026-01-27 | 2027-03-27 | 2028-03-27 | Standard support |
| 1.34 | 2025-08-27 | 2025-10-02 | 2026-12-02 | 2027-12-02 | Standard support (entering extended support soon) |
| 1.33 | 2025-04-23 | 2025-05-29 | 2026-07-29 | 2027-07-29 | Extended support |
| 1.32 | 2024-12-11 | 2025-01-23 | 2026-03-23 | 2027-03-23 | Extended support |
| 1.31 | 2024-08-13 | 2024-09-26 | 2025-11-26 | 2026-11-26 | Extended support (ending soon, then automatic upgrade) |
Note: upstream Kubernetes ended community support for 1.34 on 2026-10-27, while EKS standard support for 1.34 runs until 2026-12-02. EKS backports security patches for versions that are still supported.
Why: what happens if you don't upgrade
- After standard support ends, the cluster moves to extended support automatically by default (
upgradePolicy.supportType=EXTENDED), and the control plane is billed at a higher hourly rate. - Clusters set to
STANDARDare upgraded automatically when standard support ends. When extended support ends, the control plane of every cluster is upgraded automatically. But managed node groups and self-managed nodes are not upgraded, and neither are add-ons, so they can end up outside the allowed version skew. - New features (for example, the HPA scale-to-zero beta in 1.37, KYAML, in-place resize, and so on) are available only after you upgrade. Note: EKS enables only GA features and “new versions of existing beta APIs”. New beta APIs are not enabled by default. Alpha features are not supported.
How: upgrade order
- Prepare: read the EKS release notes and the upstream deprecation / removal list. Run
aws eks list-insightsto check UPGRADE_READINESS (use of deprecated APIs, kubelet / kube-proxy skew, add-on compatibility, cluster health). Upgrade the components you install yourself (LBC, Karpenter, Helm charts) to versions that support the target version. Confirm that PDBs can still be satisfied. - Control plane:
eksctl upgrade cluster --version 1.37 --approve(oraws eks update-cluster-version). You can upgrade only one minor version at a time. It takes about 10–20 minutes. The API stays available during the upgrade, because the apiserver is replaced in a rolling fashion. - Managed add-ons: update vpc-cni, coredns, kube-proxy, eks-pod-identity-agent and aws-ebs-csi-driver to the versions recommended for the target version. The kube-proxy version should match the cluster minor version. Upgrade vpc-cni one minor version at a time. In Auto Mode, AWS handles the core components.
- Nodes:
- Managed node groups:
eksctl upgrade nodegroup --kubernetes-version 1.37. Based onupdateConfig.maxUnavailable(default 1), EKS first adds new nodes, then cordons and drains the old nodes (respecting PDBs; by default, the drain is forced after a timeout), and then scales down. - Karpenter: when a NodePool / EC2NodeClass uses
al2023@latestor a newer AMI, the AMI resolution changes after the control plane upgrade → drift → nodes are replaced in a rolling fashion according to the budgets. - Auto Mode: after the control plane upgrade, Auto Mode replaces nodes automatically, respecting PDBs and the disruption budgets in the NodePool.
- Fargate: restart Pods to get the new kubelet version.
- Managed node groups:
- Verify:
kubectl get nodesshows matching versions, add-ons are ACTIVE, and an application smoke test passes. Refresh the cluster insights again.
Rollback (new capability; the official docs are the reference): according to the EKS docs, clusters upgraded in place can be rolled back to the previous minor version within 7 days after the upgrade. EKS provides insights in the ROLLBACK_READINESS category (ERROR / UNKNOWN blocks the rollback; you can bypass it with --force). Rollback is not an “undo button”. Objects that use the new API versions may be incompatible, so always check the insights first.
When: how to choose observability
| Option | Content | Enable |
|---|---|---|
| CloudWatch Container Insights (enhanced observability) | Cluster / node / Pod / container metrics, logs (Fluent Bit), console views; Application Signals optional | EKS add-on amazon-cloudwatch-observability (the CloudWatch agent identity uses Pod Identity) |
| Amazon Managed Service for Prometheus (AMP) + Managed Grafana | Managed Prometheus storage and queries. A managed scraper means you don't need to run Prometheus inside the cluster. | aws amp create-workspace, aws amp create-scraper, or ADOT / Prometheus remote_write from inside the cluster |
| Control plane logs | api / audit / authenticator / controllerManager / scheduler → CloudWatch Logs | ClusterConfig cloudWatch.clusterLogging or aws eks update-cluster-config --logging |
| Self-managed kube-prometheus-stack | Hour 6 M4 approach | Helm |
Comparison with AKS
| Dimension | EKS | AKS |
|---|---|---|
| Automatic upgrades | No “channels”. The control plane is upgraded only when the support period ends. | none / patch / stable / rapid channels + maintenance windows |
| Node image updates | Managed node groups: manual / Karpenter drift / Auto Mode: automatic | Node OS channel (NodeImage, etc.) |
| Pre-upgrade checks | Cluster insights (upgrade insights) | Stops the upgrade when deprecated APIs are detected (Automatic), az aks get-upgrades |
| Support period | 14 + 12 months (extended support costs extra) | About 12 months + LTS (Premium) |
EKS version lifecycle (timeline)
Dependency order for a single minor-version upgrade
Step-by-step animation: upgrading eks-lab from 1.36 to 1.37
Switch between “Auto Mode” and “managed node group” to see the differences in the node phases.
Command table
| Command | Purpose | Key parameters |
|---|---|---|
aws eks describe-cluster-versions | Available versions, default version, support dates | --cluster-versions 1.37 |
aws eks start-insights-refresh --cluster-name X | Manually refresh cluster insights | - |
aws eks list-insights --cluster-name X --filter '{"categories":["UPGRADE_READINESS"]}' | Upgrade insights | "statuses":["ERROR","WARNING"] |
aws eks describe-insight --cluster-name X --id ID | Details, affected resources, recommendations | - |
eksctl upgrade cluster --name X --version 1.37 --approve | Upgrade the control plane | Without --approve, it only prints the plan |
aws eks describe-addon-versions --kubernetes-version 1.37 --addon-name kube-proxy | Compatible add-on versions | --query "addons[].addonVersions[?compatibilities[0].defaultVersion]" |
aws eks update-addon --cluster-name X --addon-name A --addon-version V | Upgrade add-ons | --resolve-conflicts PRESERVE |
eksctl upgrade nodegroup --cluster X --name NG --kubernetes-version 1.37 | Rolling upgrade of managed node groups | --force-upgrade (ignores PDBs; use with caution) |
aws eks create-addon --addon-name amazon-cloudwatch-observability | Enable Container Insights | --pod-identity-associations |
1. Pre-upgrade checks
aws eks start-insights-refresh --cluster-name eks-lab
aws eks describe-insights-refresh --cluster-name eks-lab --query status
aws eks list-insights --cluster-name eks-lab --filter '{"categories":["UPGRADE_READINESS"]}' \
--query "insights[].[name,kubernetesVersion,insightStatus.status]" --output table
| Deprecated APIs removed in Kubernetes v1.37 | 1.37 | PASSING | | Kubelet version skew | 1.37 | PASSING | | kube-proxy version skew | 1.37 | PASSING | | EKS add-on version compatibility | 1.37 | PASSING | | Cluster health issues | 1.37 | PASSING |
How to read it: Error usually means the issue affects N+1 (the next minor version), Warning means it affects N+2 and later, and Unknown means it can't be determined. The deprecated API check is based on audit data from the last 30 days. Additional checks: kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis, pluto / kubent (hour 6 M6).
2. Upgrade the control plane
eksctl upgrade cluster --name eks-lab --version 1.37 # view the plan first
eksctl upgrade cluster --name eks-lab --version 1.37 --approve
aws eks describe-cluster --name eks-lab --query "cluster.{v:version,p:platformVersion,s:status}"
aws eks list-updates --name eks-lab
aws eks describe-update --name eks-lab --update-id <id> --query "update.{type:type,status:status,errors:errors}"
3. Upgrade managed add-ons (eks-mng)
for a in kube-proxy coredns vpc-cni eks-pod-identity-agent aws-ebs-csi-driver; do
V=$(aws eks describe-addon-versions --kubernetes-version 1.37 --addon-name $a \
--query "addons[0].addonVersions[?compatibilities[0].defaultVersion==\`true\`].addonVersion | [0]" --output text)
CUR=$(aws eks describe-addon --cluster-name eks-mng --addon-name $a --query addon.addonVersion --output text)
echo "$a: $CUR -> $V"
done
aws eks update-addon --cluster-name eks-mng --addon-name kube-proxy --addon-version <V> --resolve-conflicts PRESERVE
aws eks wait addon-active --cluster-name eks-mng --addon-name kube-proxy
Common mistake: --resolve-conflicts OVERWRITE changes fields you edited manually back to their defaults; PRESERVE keeps them. If an add-on update fails, aws eks describe-addon … --query addon.health shows the problem.
4. Upgrade nodes
# Managed node group eksctl upgrade nodegroup --cluster eks-mng --name ng-general --kubernetes-version 1.37 kubectl get nodes -L eks.amazonaws.com/nodegroup -w # Auto Mode: happens automatically after the control plane upgrade; just observe kubectl get nodeclaims -o custom-columns=N:.metadata.name,NODE:.status.nodeName,DRIFT:.status.conditions[?(@.type==\"Drifted\")].status kubectl get nodes -o custom-columns=N:.metadata.name,V:.status.nodeInfo.kubeletVersion
5. Observability: Container Insights and control plane logs
aws iam create-role --role-name eks-lab-cw-agent --assume-role-policy-document file://trust.json
aws iam attach-role-policy --role-name eks-lab-cw-agent --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
aws eks create-addon --cluster-name eks-lab --addon-name amazon-cloudwatch-observability \
--pod-identity-associations serviceAccount=cloudwatch-agent,roleArn=arn:aws:iam::$ACCT:role/eks-lab-cw-agent
kubectl -n amazon-cloudwatch get pods
aws eks update-cluster-config --name eks-lab --logging '{"clusterLogging":[{"types":["api","audit","authenticator"],"enabled":true}]}'
Container Insights and control plane logs are billed by data volume. When the lab is over, delete the add-ons and the log groups /aws/eks/eks-lab/cluster and /aws/containerinsights/eks-lab/*. For the creation parameters of the AMP managed scraper (scrape config, subnets, security groups), follow the AMP docs.
Lab 7: eks-lab 1.36 → 1.37 minor-version upgrade drill (about 30 minutes, mostly waiting)
kubectl -n shop scale deploy/api --replicas=3 kubectl -n shop create pdb api --selector=app=api --min-available=2 kubectl -n shop run probe --image=busybox:1.37 --restart=Never -- sh -c 'while true; do wget -q -T 2 -O- http://api:9898/healthz >/dev/null && echo ok || echo FAIL; sleep 1; done'
kubectl get nodes should stay available (occasional connection resets can be retried).kubectl get nodes -o custom-columns=N:.metadata.name,V:.status.nodeInfo.kubeletVersion -w kubectl -n shop logs probe --since=30m | grep -c FAIL # ideally 0 kubectl get events -A --field-selector reason=Evicted --sort-by=.lastTimestamp | tail
AWS controls when nodes are replaced. Replacement may start a few minutes after the control plane upgrade finishes, or later. PDBs make the replacement happen one node at a time.
aws eks list-insights is refreshed, the ROLLBACK_READINESS category appears (within the 7-day window). The application probe shows no failures, or only a very few.kubectl -n shop delete pod probe. Keep the PDB.Case 1: quarterly upgrade pipeline for 30 clusters
The platform team upgrades once a quarter: dev → staging → prod, one week apart. Pipeline steps: refresh insights (any ERROR fails the pipeline) → upgrade the LBC / Karpenter / ESO managed by Helm → eksctl upgrade cluster → add-ons → nodes (Karpenter drift, with budgets limited to outside working hours) → smoke tests. All clusters use upgradePolicy=STANDARD to avoid “accidentally paying for extended support”, together with AWS Health notifications 60 days in advance.
Case 2: a billing surprise from extended support
A team had 6 dev clusters stuck on 1.31. After they entered extended support, the control plane costs rose several times over. The fix: report each cluster's support status regularly, using aws eks describe-cluster-versions and the resource manifests. Rebuild the dev clusters directly at 1.37 (restored through GitOps) instead of upgrading them one step at a time six times.
Case 3: slower CoreDNS resolution after an upgrade
After upgrading the control plane, the team forgot to upgrade the coredns add-on, and the node count doubled, leaving too few CoreDNS replicas. The fix: upgrade the add-on and set autoScaling through --configuration-values. (The coredns add-on supports autoscaling based on cluster size; check the exact fields against the add-on configuration schema: aws eks describe-addon-configuration --addon-name coredns --addon-version V.)
Common errors and fixes
InvalidParameterException: Unsupported Kubernetes minor version update from 1.35 to 1.37
Cause: you skipped a minor version.
Fix: upgrade to 1.36 first (including add-ons and nodes, within their compatible range), then upgrade to 1.37.
Node group upgrade failed: PodEvictionFailure — Reached max retries while trying to evict pods from nodes in node group
Cause: the PDB can't be satisfied (a single replica with minAvailable 1, or Pods that can't be scheduled on other nodes).
kubectl get pdb -A -o custom-columns=NS:.metadata.namespace,N:.metadata.name,ALLOWED:.status.disruptionsAllowed | awk '$3==0' aws eks describe-update --name eks-mng --nodegroup-name ng-general --update-id <id>
Fix: temporarily scale up the replicas or adjust the PDB, then retry. --force-upgrade ignores PDBs and may cause downtime.
Add-on update failed: ConfigurationConflict — Conflicts found when trying to apply. Will not continue due to resolve conflicts mode
Cause: a managed field was changed manually.
Fix: move the custom values into --configuration-values, then use --resolve-conflicts OVERWRITE (overwrites manual changes) or PRESERVE.
After the upgrade, some workloads fail with: the server could not find the requested resource (a removed API version is in use)
Cause: the Helm release / CI manifests still reference a removed apiVersion. Insights can only find clients that made calls in the last 30 days.
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis helm get manifest RELEASE -n NS | grep apiVersion | sort | uniq -c
Migrate the manifests to the new API. If needed, evaluate a rollback within 7 days (check the ROLLBACK_READINESS insights first).
1. List only the upgrade insights whose status is ERROR or WARNING.
Reference answer
aws eks list-insights --cluster-name eks-lab \
--filter '{"categories":["UPGRADE_READINESS"],"statuses":["ERROR","WARNING"]}'2. Query the default version of the coredns add-on on Kubernetes 1.37.
Reference answer
aws eks describe-addon-versions --kubernetes-version 1.37 --addon-name coredns \ --query "addons[0].addonVersions[?compatibilities[0].defaultVersion==\`true\`].addonVersion" --output text
Scenario analysis question: today is 2026-11-15. You take over a production 1.33 cluster (managed node groups + a self-installed Karpenter 1.x from an older release + LBC v2.x). Draw up an upgrade plan.
Reference answer
1.33 is already in extended support (with extra cost; it ends on 2027-07-29). You need 4 upgrades: 1.33→1.34→1.35→1.36→1.37. For each one: refresh insights → check compatibility of self-installed components (upgrade Karpenter and LBC first to versions that support the target version; pay attention to the change notes for LBC v2→v3 and for Karpenter major releases) → control plane → add-ons → nodes (node groups + Karpenter drift) → verify. To reduce the number of steps, consider a “blue-green cluster”: create a new 1.37 cluster (possibly in Auto Mode), deploy through GitOps, shift traffic with weighted DNS, and then decommission the old cluster. For clusters that are many versions behind, this is usually faster and safer. Also set upgradePolicy to STANDARD and establish a quarterly upgrade rhythm.
Teaching video (title and channel verified via YouTube oEmbed, 2026-11-15)
Official docs
- Kubernetes version lifecycle on EKS
- Update existing cluster
- Cluster insights
- View cluster insights
- EKS add-ons
- Container Insights (EKS add-on)
- Best Practices · Cluster upgrades
Video storyboard script
This courseware cannot generate a video or MP3 directly, so it provides a storyboard and narration script.
Narration: each version on EKS gets 14 months of standard support and 12 months of extended support. Extended support costs extra.
Narration: before you upgrade, refresh the cluster insights to check deprecated APIs, version skew, and add-on compatibility.
Narration: upgrade only one minor version at a time: control plane first, then add-ons, and nodes last.
Narration: Auto Mode replaces nodes automatically after the control plane upgrade, provided you have configured multiple replicas and disruption budgets.
Module 8 · EKS troubleshooting decision tree and cleanup
- Troubleshoot EKS failures in this order: the K8s layer → the seam layer (CNI / IAM / controllers) → the AWS layer. Know which log and which API to check for each type of problem.
- Be comfortable handling: Pods that can't get an IP, nodes that won't join the cluster, kubectl Unauthorized, LoadBalancers that aren't created, PVCs stuck in Pending (AZ mismatch), Pods denied access to AWS, and ECR image pull failures.
- Perform a complete cleanup in dependency order: LB-type Services / Ingresses → nodes (Karpenter / Auto Mode / node groups) → the cluster → check for leftover ENIs / LBs / volumes / logs.
What: the three-layer model for EKS failures
| Layer | Typical symptoms | Evidence source |
|---|---|---|
| Kubernetes layer | CrashLoopBackOff, failing probes, RBAC 403, scheduling constraints | kubectl describe / logs / events (hour 6 M8) |
| Seam layer (EKS-specific) | Pods without IPs, nodes that don't register, LBs that aren't created, PVCs that don't bind, Pods without AWS credentials | aws-node / ipamd logs, LBC logs, CSI controller logs, Karpenter events, access entries, Pod Identity associations, managed add-on health |
| AWS layer | Subnet IP exhaustion, quotas (vCPU, ENI, LB), security groups / NACLs, IAM denials, SCPs, service events | CloudTrail (errorCode), describe-subnets, Service Quotas, AWS Health, VPC flow logs |
Why: why EKS cleanup often fails
eksctl only deletes the CloudFormation stacks it created. Resources that controllers create dynamically while the cluster is running are not in any stack:
- ALBs, NLBs, target groups and security groups created by the LBC / Auto Mode;
- EC2 instances and their ENIs launched by Karpenter / Auto Mode;
- Secondary ENIs created by the VPC CNI (usually deleted along with the node when it terminates, but they can be left behind in the “available” state if something goes wrong);
- EBS volumes created by CSI (with reclaimPolicy Retain, or PVCs that were not deleted), EFS access points, snapshots;
- CloudWatch log groups, Secrets Manager secrets, ECR images, and IAM roles (the ones you created yourself with the CLI).
These resources can leave the VPC stack in DELETE_FAILED (subnets / security groups still in use by ENIs), and they keep incurring charges.
How: the dependency order for cleanup
- Delete external entry points: all Ingresses,
type: LoadBalancerServices, and Gateways. Let the controllers delete the ALBs/NLBs while they are still running. - Delete stateful resources: StatefulSets and PVCs (confirm the EBS volumes are deleted), and VolumeSnapshots.
- Delete nodes: delete the workloads and custom NodePools → Karpenter / Auto Mode terminates the instances. eksctl deletes managed node groups.
- Delete the cluster:
eksctl delete cluster --name eks-lab --wait(this deletes the Pod Identity associations, the IAM roles eksctl created, the node group stacks, the cluster stack, and the VPC stack). - Check for leftovers: search for LBs, ENIs, EBS volumes, security groups, log groups, IAM roles / policies, S3 buckets and secrets, filtered by tags and VPC ID.
When: stop the bleeding first
During a production incident, still follow the hour 6 principle: stop the bleeding first (roll back, scale out, shift traffic), then find the root cause. EKS-specific ways to stop the bleeding: widen the instance types in the NodePool or temporarily switch back to on-demand; if subnet IPs run out, temporarily lower the WARM settings or add subnets; if the LBC fails, the ALB keeps working (the data plane is independent of the controller). It just stops updating targets, so don't rush to delete the Ingress.
eksctl delete cluster deletes everything.” It does not delete the LBs, volumes, and so on that controllers created dynamically (see above). ② “If deleting an Ingress gets stuck, remove the finalizer.” That leaves the ALB orphaned. ③ “If a node is NotReady, SSH in and check.” Auto Mode does not support SSH; use kubectl get nodeclaims, the EC2 console output, or a NodeDiagnostic to collect logs. ④ “Unauthorized is an RBAC problem.” A 401 is an authentication problem (access entry / token); only a 403 is an authorization problem.Cleanup dependency graph (delete from top to bottom)
Seam-layer failure map
Step-by-step animation: clean up eks-lab in dependency order (and what happens if the order is wrong)
EKS troubleshooting command cheat sheet
| Symptom | First command | Second command |
|---|---|---|
| Pod has no IP | kubectl describe pod P (FailedCreatePodSandBox) | aws ec2 describe-subnets --query "Subnets[].[SubnetId,AvailableIpAddressCount]" |
| Node won't register | kubectl get nodeclaims / eksctl get nodegroup | aws eks list-access-entries, aws ec2 get-console-output |
| Unauthorized | aws sts get-caller-identity | aws eks list-access-entries |
| LB not created | kubectl describe ingress/svc | kubectl -n kube-system logs deploy/aws-load-balancer-controller |
| PVC Pending | kubectl describe pvc | kubectl get sc,csidrivers |
| AWS call denied | kubectl exec P -- env | grep AWS_ | aws eks list-pod-identity-associations |
| ECR pull failed | kubectl describe pod P (Failed to pull image) | Check whether the node role has AmazonEC2ContainerRegistryPullOnly (or ReadOnly) |
| Managed add-on problem | aws eks describe-addon --query addon.health | kubectl -n kube-system get pods |
1. One-click “live snapshot” (run this first when an incident starts)
C=eks-lab; NS=shop; OUT=incident-$(date +%Y%m%d-%H%M); mkdir -p $OUT
aws eks describe-cluster --name $C > $OUT/cluster.json
kubectl get nodes -o wide > $OUT/nodes.txt
kubectl get nodeclaims,nodepools -o wide > $OUT/karpenter.txt 2>&1
kubectl get events -A --sort-by=.lastTimestamp > $OUT/events.txt
kubectl -n $NS get all,ingress,pvc -o wide > $OUT/ns.txt
for a in $(aws eks list-addons --cluster-name $C --query addons --output text); do
aws eks describe-addon --cluster-name $C --addon-name $a --query "addon.{n:addonName,v:addonVersion,s:status,h:health}" --output json; done > $OUT/addons.json
aws ec2 describe-subnets --filters Name=vpc-id,Values=$(jq -r .cluster.resourcesVpcConfig.vpcId $OUT/cluster.json) \
--query "Subnets[].[SubnetId,AvailabilityZone,AvailableIpAddressCount]" --output table > $OUT/subnets.txt
ls $OUT
2. CloudTrail: find the denied AWS calls
aws cloudtrail lookup-events --start-time $(date -u -d '-30 min' +%Y-%m-%dT%H:%M:%SZ) --max-results 50 \ --query "Events[].CloudTrailEvent" --output text | jq -r 'select(.errorCode!=null) | [.eventTime,.eventSource,.eventName,.errorCode,.userIdentity.arn] | @tsv' | head
2026-11-15T15:02:11Z s3.amazonaws.com GetObject AccessDenied arn:aws:sts::111122223333:assumed-role/shop-api-s3-read/eks-eks-lab-api-7c… 2026-11-15T15:01:40Z elasticloadbalancing.amazonaws.com CreateLoadBalancer ValidationError arn:aws:sts::…:assumed-role/…LoadBalancerController…
Data events (such as S3 GetObject) are recorded only if the CloudTrail trail has data events enabled. Management events are kept for 90 days and can be queried by default.
3. ECR pull failures
kubectl -n shop describe pod P | grep -A3 -E "Failed|pull" # The node role (managed node group / Karpenter) should have AmazonEC2ContainerRegistryPullOnly (or ReadOnly) attached aws iam list-attached-role-policies --role-name <node-role-name> --query "AttachedPolicies[].PolicyName" # Private subnets without a NAT need VPC endpoints: com.amazonaws.ca-central-1.ecr.api, ecr.dkr, plus the S3 gateway endpoint aws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=$VPC_ID --query "VpcEndpoints[].ServiceName"
4. Full cleanup (eks-lab)
C=eks-lab # ① Entry points: delete all Ingresses and LoadBalancer Services first (and Gateways) kubectl delete ingress --all -A kubectl get svc -A -o json | jq -r '.items[] | select(.spec.type=="LoadBalancer") | "\(.metadata.namespace) \(.metadata.name)"' \ | while read ns n; do kubectl -n $ns delete svc $n; done kubectl get gateway -A 2>/dev/null && kubectl delete gateway --all -A # Wait for the LBs to finish deleting aws resourcegroupstaggingapi get-resources --tag-filters Key=elbv2.k8s.aws/cluster,Values=$C --resource-type-filters elasticloadbalancing:loadbalancer --query "ResourceTagMappingList[].ResourceARN" # ② Stateful resources kubectl delete sts --all -n shop; kubectl delete pvc --all -n shop # ③ Workloads and custom NodePools (the built-in Auto Mode NodePools are deleted with the cluster) kubectl delete ns shop kubectl delete nodepool spot-flex --ignore-not-found # ④ Delete the cluster eksctl delete cluster --name $C --region ca-central-1 --wait # ⑤ Check for leftovers aws ec2 describe-volumes --filters Name=status,Values=available --query "Volumes[].[VolumeId,Tags[?Key=='eks:eks-cluster-name'].Value|[0]]" --output table aws ec2 describe-network-interfaces --filters Name=status,Values=available --query "NetworkInterfaces[].[NetworkInterfaceId,VpcId,Description]" --output table aws logs describe-log-groups --log-group-name-prefix /aws/eks/$C --query "logGroups[].logGroupName" aws logs describe-log-groups --log-group-name-prefix /aws/containerinsights/$C --query "logGroups[].logGroupName" aws cloudformation list-stacks --stack-status-filter DELETE_FAILED --query "StackSummaries[?contains(StackName,'$C')].StackName"
Common errors: the cluster was deleted first → the ALB and security groups were left behind → the VPC stack is DELETE_FAILED. Fix: manually delete the LBs and target groups with the k8s-* prefix, then delete the security groups and the available ENIs, then retry with aws cloudformation delete-stack. IAM roles you created yourself with the CLI (shop-api-s3-read, eks-lab-cw-agent, etc.), S3 buckets, and secrets must be deleted separately.
Lab 8: fault injection + locating faults with the decision tree (about 15 minutes)
kubectl -n shop set image deploy/api podinfo=ghcr.io/stefanprodan/podinfo:9.9.9-nope kubectl -n shop get pods -w
On the Troubleshooting tab, select “Pod status abnormal → ImagePullBackOff” in the decision tree, follow the prompts to locate the fault, and run kubectl -n shop rollout undo deploy/api.
rollout restart, then run aws s3 ls inside the Pod. Use the decision tree to locate the “no credentials” case, then restore the association.loadBalancerClass: service.k8s.aws/nlb (no LBC is there to handle it) → EXTERNAL-IP stays pending → use the decision tree to locate the issue, then change it to eks.amazonaws.com/nlb or delete the field. Note: loadBalancerClass cannot be changed after creation, so you need to delete and recreate the Service.provisioner: ebs.csi.aws.com and a PVC, and mount it to a Pod (the driver is not present in Auto Mode clusters) → locate the wrong provisioner name.Case 1: a “ghost” NLB costing 400 USD per month
FinOps found 9 k8s-* NLBs with no targets. Cause: a test cluster was deleted directly with eksctl delete cluster, so the NLBs left behind by the LoadBalancer Services became orphans. Fix: the cleanup script enforces “delete entry points first, then the cluster”, and uses AWS Config rules or periodic reports to find LBs tagged elbv2.k8s.aws/cluster whose cluster no longer exists.
Case 2: all new nodes NotReady
The platform team migrated the node role to a new role name and changed role in the Karpenter EC2NodeClass, but forgot to create an access entry for the new role. NodeClaims stayed in Launched and never reached Registered. Troubleshooting path: “node doesn't join the cluster → self-installed Karpenter / self-managed nodes → access entry”. Fix: aws eks create-access-entry --type EC2_LINUX.
Case 3: ContainerCreating during the Monday morning peak
During the morning peak, HPA scaled Pods from 200 to 600, and subnet IPs ran out. Immediate mitigation: temporarily lower WARM_IP_TARGET to reduce warm-pool usage, and move part of the load to another cluster. Permanent fix: add a secondary CIDR with custom networking, and add subnet available-IP counts to CloudWatch alarms (custom metrics or VPC IPAM monitoring).
EKS interactive troubleshooting decision tree
Work from the symptom step by step. Each leaf node gives the cause, the diagnostic command, and the fix. Covers all the common failures from M1–M7 in this hour.
Common errors and fixes (additional)
DELETE_FAILED: The subnet 'subnet-…' has dependencies and cannot be deleted / resource sg-… has a dependent object
Cause: the subnet or security group is still in use by ENIs (orphaned LBs, Karpenter instances that were not terminated, ENIs in the available state).
aws ec2 describe-network-interfaces --filters Name=subnet-id,Values=subnet-… --query "NetworkInterfaces[].[NetworkInterfaceId,Status,Description,RequesterId]" --output table
Based on the Description, identify the owner (ELB app/k8s-…, aws-K8S-i-…), delete the matching resources, then retry deleting the stack.
Failed to pull image "111122223333.dkr.ecr.ca-central-1.amazonaws.com/shop/api:1.0": … 403 Forbidden / no basic auth credentials
Cause: the node role lacks ECR pull permission; the cross-account ECR repository policy does not grant access; or the private subnet has no path to ECR.
aws ecr get-repository-policy --repository-name shop/api aws iam attach-role-policy --role-name <node-role> --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPullOnly
Auto Mode node NotReady, cannot troubleshoot via SSH
Approach: use kubectl describe node and kubectl get nodeclaim -o yaml to check the conditions. In the EC2 console, use “Get system log”. Use the NodeDiagnostic resource in Auto Mode to collect node logs to S3 (check the fields against the Auto Mode troubleshooting docs). If needed, delete the NodeClaim so Karpenter replaces the node.
1. Write a command that lists all ENIs in the available state (not attached) in a given VPC.
Reference answer
aws ec2 describe-network-interfaces --filters Name=vpc-id,Values=$VPC_ID Name=status,Values=available \ --query "NetworkInterfaces[].[NetworkInterfaceId,Description]" --output table
2. Before deleting eks-lab, list all Kubernetes objects in the cluster that create AWS load balancers.
Reference answer
kubectl get ingress -A kubectl get svc -A --field-selector spec.type=LoadBalancer kubectl get gateway -A 2>/dev/null kubectl get targetgroupbindings -A 2>/dev/null
Scenario analysis question: a new colleague reports: “kubectl get pods returns Unauthorized, but it worked yesterday.” Give the troubleshooting order.
Reference answer
401 = authentication failure. ① aws sts get-caller-identity: has the SSO session expired (aws sso login), and is the current profile correct? ② does the exec configuration in kubeconfig point to the correct profile / role (aws eks update-kubeconfig --profile)? ③ aws eks list-access-entries: was the access entry for the role deleted (check DeleteAccessEntry in CloudTrail), or did recreating the Identity Center permission set change the role name suffix (SSO role ARNs contain a random suffix)? ④ was the cluster authentication mode just switched to API, while the access is only in aws-auth?
Teaching video
No verified video was found. No official video with an ID that could be verified through YouTube oEmbed was found for the EKS troubleshooting and cleanup topics.
Official docs
- Troubleshoot problems with Amazon EKS clusters and nodes
- Troubleshoot EKS Auto Mode
- eksctl docs
- Karpenter Troubleshooting
Video storyboard script
This courseware cannot generate a video or MP3 directly, so it provides a storyboard and narration script.
Narration: EKS-specific failures mostly happen at the seams between Kubernetes and AWS: IPs, IAM, subnet tags, and availability zones.
Narration: from the events, find the component that failed. From its logs, find the cause. Then use CloudTrail to confirm AWS's reason for the denial.
Narration: cleanup has to go in reverse. First let the controllers delete the load balancers and volumes they created, then delete the cluster.
Narration: if you get the order wrong, the load balancer keeps billing, and the VPC can't be deleted.
Command cheat sheet
eksctl: clusters and node groups
eksctl create cluster --name eks-lab --region ca-central-1 --enable-auto-mode eksctl create cluster -f cluster.yaml [--dry-run] eksctl get cluster | nodegroup --cluster X | addon --cluster X eksctl update auto-mode-config -f cluster.yaml eksctl create nodegroup --cluster X --name ng --node-type m6i.large --nodes 2 eksctl scale nodegroup --cluster X --name ng --nodes 0 --nodes-min 0 eksctl upgrade cluster --name X --version 1.37 --approve eksctl upgrade nodegroup --cluster X --name ng --kubernetes-version 1.37 eksctl create fargateprofile --cluster X --name fp --namespace batch eksctl delete cluster --name X --wait
aws eks: clusters, add-ons, versions
aws eks describe-cluster --name X --query cluster.{v:version,auth:accessConfig}
aws eks update-kubeconfig --name X --alias X [--role-arn ARN]
aws eks describe-cluster-versions
aws eks update-cluster-config --name X --upgrade-policy supportType=STANDARD
aws eks list-addons --cluster-name X
aws eks describe-addon-versions --kubernetes-version 1.37 --addon-name vpc-cni
aws eks update-addon --cluster-name X --addon-name vpc-cni --addon-version V \
--configuration-values '{"env":{"ENABLE_PREFIX_DELEGATION":"true"}}' --resolve-conflicts PRESERVE
aws eks start-insights-refresh --cluster-name X
aws eks list-insights --cluster-name X --filter '{"categories":["UPGRADE_READINESS"]}'Identity: access entries and Pod Identity
aws eks list-access-entries --cluster-name X aws eks create-access-entry --cluster-name X --principal-arn ROLE_ARN [--kubernetes-groups g] aws eks associate-access-policy --cluster-name X --principal-arn ROLE_ARN \ --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy \ --access-scope type=namespace,namespaces=shop aws eks update-cluster-config --name X --access-config authenticationMode=API aws eks create-pod-identity-association --cluster-name X --namespace shop \ --service-account api --role-arn ROLE_ARN aws eks list-pod-identity-associations --cluster-name X kubectl auth whoami
Networking: VPC CNI and IPs
kubectl -n kube-system get ds aws-node -o jsonpath='{.spec.template.spec.containers[0].image}'
kubectl get nodes -o custom-columns=N:.metadata.name,MAX:.status.allocatable.pods
aws ec2 describe-instance-types --instance-types m5.large \
--query "InstanceTypes[].NetworkInfo.[MaximumNetworkInterfaces,Ipv4AddressesPerInterface]"
aws ec2 describe-subnets --filters Name=vpc-id,Values=$VPC \
--query "Subnets[].[SubnetId,AvailabilityZone,AvailableIpAddressCount]" --output table
aws ec2 describe-network-interfaces --filters Name=attachment.instance-id,Values=i-…
# max pods = ENI × (IP/ENI − 1) + 2; prefix mode recommends 110 (<30 vCPU)Traffic: LBC / Auto Mode
helm upgrade --install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system \ --set clusterName=X --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller kubectl get ingressclass # ingress.k8s.aws/alb (LBC) / eks.amazonaws.com/alb (Auto) # Ingress annotations alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip alb.ingress.kubernetes.io/group.name: public # Service loadBalancerClass: service.k8s.aws/nlb # Auto Mode: eks.amazonaws.com/nlb service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip kubectl label ns shop elbv2.k8s.aws/pod-readiness-gate-inject=enabled
Storage and secrets
kubectl get sc,csidrivers
# provisioner: ebs.csi.aws.com (add-on) / ebs.csi.eks.amazonaws.com (Auto) / efs.csi.aws.com
aws eks create-addon --cluster-name X --addon-name aws-ebs-csi-driver \
--pod-identity-associations serviceAccount=ebs-csi-controller-sa,roleArn=ARN
kubectl get pv -o custom-columns=N:.metadata.name,VOL:.spec.csi.volumeHandle,ZONE:.spec.nodeAffinity.required.nodeSelectorTerms[0].matchExpressions[0].values
kubectl patch pvc P --type=merge -p '{"spec":{"volumeAttributesClassName":"gp3-6000-250"}}'
aws ec2 describe-volumes --filters Name=status,Values=availableKarpenter / Auto Mode compute
kubectl get nodepools,nodeclaims -o wide kubectl get ec2nodeclasses # self-installed; Auto Mode: kubectl get nodeclasses kubectl get nodes -L karpenter.sh/nodepool,karpenter.sh/capacity-type,node.kubernetes.io/instance-type kubectl get events -A --field-selector source=karpenter --sort-by=.lastTimestamp kubectl annotate pod P karpenter.sh/do-not-disrupt=true helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter --version 1.15.2 -n kube-system \ --set settings.clusterName=X --set settings.interruptionQueue=X
Cleanup and leftover checks
kubectl delete ingress --all -A kubectl get svc -A --field-selector spec.type=LoadBalancer kubectl delete pvc --all -n shop eksctl delete cluster --name X --wait aws resourcegroupstaggingapi get-resources --tag-filters Key=elbv2.k8s.aws/cluster,Values=X aws ec2 describe-network-interfaces --filters Name=status,Values=available aws cloudformation list-stacks --stack-status-filter DELETE_FAILED aws logs describe-log-groups --log-group-name-prefix /aws/eks/X
Quick troubleshooting table
| Symptom | Most likely cause | Check first | Module |
|---|---|---|---|
| Pod ContainerCreating: failed to assign an IP address | Subnet IPs exhausted / ENI limit | describe-subnets AvailableIpAddressCount | M2 |
| Node CPU is mostly idle but Pods are Pending (Too many pods) | max pods (ENI × IP) | allocatable.pods | M2 |
| kubectl Unauthorized (401) | No access entry / SSO expired / used a session ARN | sts get-caller-identity, list-access-entries | M3 |
| kubectl Forbidden (403) | access policy scope / RBAC | list-associated-access-policies | M3 |
| Unable to locate credentials inside a Pod | No Pod Identity association / Pod not restarted / Agent not installed | env | grep AWS_ | M3 |
| Ingress has no ADDRESS | Subnet tags / IngressClass / LBC permissions | describe ingress Events | M4 |
| Service EXTERNAL-IP pending | loadBalancerClass not handled by anyone | spec.loadBalancerClass | M4 |
| PVC Pending / volume node affinity conflict | Wrong provisioner name / no nodes in the AZ / Immediate | kubectl get sc,csidrivers | M5 |
| NodeClaim Launched but not Registered | Node role has no access entry / network path | describe nodeclaim | M6 |
| Upgrade reports Unsupported minor version update | Skipped a version | describe-cluster | M7 |
| VPC stack DELETE_FAILED | Orphaned LB / ENI | describe-network-interfaces --filters subnet-id | M8 |
Recommended configuration snippet
accessConfig:
authenticationMode: API
bootstrapClusterCreatorAdminPermissions: false # grant admin explicitly through IaC
vpc:
clusterEndpoints: { publicAccess: true, privateAccess: true }
publicAccessCIDRs: ["203.0.113.0/24"]
nat: { gateway: HighlyAvailable }
autoModeConfig: { enabled: true }
cloudWatch:
clusterLogging: { enableTypes: ["api","audit","authenticator"] }
secretsEncryption:
keyARN: arn:aws:kms:ca-central-1:111122223333:key/…spec:
replicas: 2
template:
spec:
serviceAccountName: api # Pod Identity association
topologySpreadConstraints:
- { maxSkew: 1, topologyKey: topology.kubernetes.io/zone,
whenUnsatisfiable: ScheduleAnyway, labelSelector: { matchLabels: { app: api } } }
terminationGracePeriodSeconds: 45
containers:
- name: api
resources: { requests: { cpu: 250m, memory: 128Mi }, limits: { memory: 256Mi } }
lifecycle: { preStop: { exec: { command: ["sleep","15"] } } } # pairs with ALB deregistration
---
# + PodDisruptionBudget minAvailable: 1 (or maxUnavailable: 1)Capstone lab + final quiz
The company decides to move shop's production environment to AWS ca-central-1. You need to: create an Auto Mode cluster with eksctl (1.36) → deploy shop (podinfo api + nginx web + postgres db) → have api read an S3 banner file and the database password from Secrets Manager through Pod Identity → expose it externally with an ALB Ingress → use an encrypted gp3 volume for db → run a load test to verify Auto Mode / Karpenter scale-out and reclamation → upgrade to 1.37 without interrupting the business → perform a complete cleanup in dependency order. Estimated cost: 2–4 USD.
eks-lab.yaml from Module 0 (1.36, Auto Mode, API authentication mode, single NAT).export AWS_PROFILE=eks-lab AWS_REGION=ca-central-1 eksctl create cluster -f eks-lab.yaml kubectl get nodepools; aws eks describe-cluster --name eks-lab --query cluster.version
kubectl create ns shop
kubectl -n shop create serviceaccount api
kubectl -n shop create deploy api --image=ghcr.io/stefanprodan/podinfo:6.17.0 --port=9898 --replicas=2
kubectl -n shop patch deploy api -p '{"spec":{"template":{"spec":{"serviceAccountName":"api"}}}}'
kubectl -n shop set resources deploy/api --requests=cpu=250m,memory=128Mi --limits=memory=256Mi
kubectl -n shop create deploy web --image=nginx:1.29-alpine --port=80 --replicas=2
kubectl -n shop expose deploy api --port=9898; kubectl -n shop expose deploy web --port=80
kubectl -n shop create pdb api --selector=app=api --min-available=1
kubectl -n shop create pdb web --selector=app=web --min-available=1
kubectl -n shop rollout status deploy/api; kubectl get nodeclaimsshop-api role (trusting pods.eks.amazonaws.com) with permissions = read-only access to S3 shop/* + secretsmanager:GetSecretValue on shop/db-*; create the association for shop/api. Following section 5 of M5, install Secrets Store CSI + ASCP, create the secret shop/db and a SecretProviderClass; then run kubectl -n shop rollout restart deploy/api.kubectl -n shop run s3test --image=public.ecr.aws/aws-cli/aws-cli:latest --restart=Never \
--overrides='{"spec":{"serviceAccountName":"api"}}' --command -- sh -c "aws s3 cp s3://$BUCKET/shop/banner.txt - && aws secretsmanager get-secret-value --secret-id shop/db --query Name"
kubectl -n shop logs s3testalb-class.yaml from M4 (Auto Mode IngressClassParams) and shop-ingress.yaml (you can change api to a host-based rule); curl http://$ALB/ returns the nginx page; in aws elbv2 describe-target-health, the targets are Pod IPs.sc-auto-gp3.yaml from M5 and db.yaml; write data → delete db-0 → the data is still there; record the volume ID and AZ.np-spot.yaml, and run a load-test Pod. Record the instance type / capacity-type / AZ of the new NodeClaims, and the Pending→Running time. After you stop the load test, observe the consolidated reclamation.eksctl upgrade cluster --version 1.37 --approve → watch Auto Mode replace nodes → count the probe failures.Open-ended self-check
1. Why is “IP planning” on EKS far more important than on AKS (CNI Overlay)?
The VPC CNI by default gives every Pod a real IP from the subnet, and the warm pool takes extra IPs on top. Both subnet size and the ENI × IP limit cap the scale. AKS Overlay Pod CIDRs are independent of the VNet. EKS needs large subnets, prefix delegation, or secondary CIDRs.
2. What is the relationship between access entries and Kubernetes RBAC?
An access entry maps an IAM principal to a Kubernetes username / groups (the identity after authentication). Authorization can be granted by access policies (the EKS authorizer) or by RBAC (bound to groups). If either one allows the request, it goes through.
3. When would you still choose IRSA over Pod Identity?
When using Fargate, when working with clusters outside EKS (self-managed, EKS Anywhere), when you need to federate directly via OIDC to other accounts or systems, or when the application SDK is too old to support the container credential provider.
4. Compared with “managed node groups + self-installed Karpenter + LBC + EBS CSI”, what do you give up and what do you gain with Auto Mode?
Gain: AWS manages installation, upgrades, and the node lifecycle for core components, and you get a secure node baseline (read-only root, no SSH, automatic rotation). Give up: custom AMIs, node login, some annotations / parameters, and control over component versions. You also pay the Auto Mode management fee.
5. For a single-replica database using EBS, how do you recover quickly after an AZ failure?
EBS volumes cannot be attached across AZs. The best option is to switch to a multi-AZ RDS / Aurora. If self-managed, use a multi-replica primary/replica setup (each replica has its own EBS volume, spread across different AZs) with scheduled snapshots. After a failure, create a new volume from a snapshot in another AZ and bind it statically.
6. List 3 EKS resources that are billed but hard to see, and how to find them.
Orphaned ALB/NLBs (tag elbv2.k8s.aws/cluster), EBS volumes and snapshots in the available state, NAT Gateways, CloudWatch log groups and Container Insights data, and control planes in extended support. Find them with Cost Explorer (by service or tag), Resource Groups tag queries, and AWS Config rules.
Sources and versions
| Topic | Verified conclusion | Source (verified on) |
|---|---|---|
| Kubernetes upstream versions | 1.37 (1.37.1, 2026-09-15), 1.36 and 1.35 are supported; 1.34 reached upstream EOL on 2026-10-27; v1.37 was released on 2026-08-26 | kubernetes.io/releases (course standard, 2026-11-15) |
| EKS version calendar | Standard support for 1.37/1.36/1.35/1.34; extended support for 1.33/1.32/1.31. 1.37 was released on EKS on 2026-10-01, with standard support until 2027-12-01 and extended support until 2028-12-01. 1.34 standard support ends 2026-12-02; 1.31 extended support ends 2026-11-26. Standard is 14 months + extended 12 months. Extended support is enabled by default (upgradePolicy EXTENDED). After an upgrade, you can roll back the minor version within 7 days. New beta APIs are not enabled by default. | Kubernetes version lifecycle on EKS (2026-11-15) |
| EKS pricing | Control plane standard support: 0.10 USD per cluster per hour. Extended support is higher (about 0.60 USD/hour; check the pricing page for the exact rate). Auto Mode charges a management fee on top of EC2. | EKS pricing; consistent with Docker hour 4 and Terraform hour 4 (2026-11-15) |
| eksctl | Latest v0.231.0 (2026-10-02), previous v0.230.0 (2026-08-14). Auto Mode requires ≥ 0.195.0. autoModeConfig.enabled / nodePools / nodeRoleARN, default NodePool general-purpose + system; eksctl update auto-mode-config | eksctl Releases · eksctl · Auto Mode (2026-11-15) |
| VPC CNI | CNI binary + ipamd (aws-node); WARM_ENI_TARGET / WARM_IP_TARGET / MINIMUM_IP_TARGET; max pods = ENI × (IP − 1) + 2; an IP is in cooldown for 30 seconds after its Pod is deleted; managed add-ons correct managed fields every 15 minutes (WARM variables are not managed) | Best Practices · VPC CNI (2026-11-15) |
| access entries | Authentication modes CONFIG_MAP / API_AND_CONFIG_MAP / API. Once access entries are enabled, they cannot be turned off. Auto Mode requires access entries. Access policy list (ClusterAdmin, Admin, Edit, View, AdminView, SecretReader, etc.) and ARN format | Grant access · Access policy permissions (2026-11-15) |
| EKS Pod Identity | Injects AWS_CONTAINER_CREDENTIALS_FULL_URI=http://169.254.170.23/v1/credentials and AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE. Token audience pods.eks.amazonaws.com, validity 86400 seconds. The Agent calls AssumeRoleForPodIdentity; IRSA uses AssumeRoleWithWebIdentity | How Pod Identity works (2026-11-15) |
| AWS Load Balancer Controller | Latest v3.6.3 (2026-11-13). Gateway API is based on v1.6.0 and passes conformance tests. ALB routes (HTTPRoute/GRPCRoute) require ≥ 2.14.0; NLB routes (TCP/UDP/TLSRoute) require ≥ 2.13.3. Enabled automatically when the CRDs exist; can be turned off with the feature gates ALBGatewayAPI / NLBGatewayAPI. L4 and L7 routes cannot be mixed. | LBC Releases · LBC Gateway API (2026-11-15) |
| Auto Mode load balancing | IngressClass controller eks.amazonaws.com/alb, IngressClassParams eks.amazonaws.com/v1 (targetType defaults to ip, group.name); Service defaults to loadBalancerClass: eks.amazonaws.com/nlb; some LBC annotations are not supported; subnet tags are required | Auto Mode ALB · Auto Mode NLB (2026-11-15) |
| Auto Mode storage | provisioner ebs.csi.eks.amazonaws.com; StorageClasses are not created automatically; allowedTopologies eks.amazonaws.com/compute-type: auto; the volume-modifier annotation is no longer supported after 2026-10-31, use VolumeAttributesClass instead; static volumes need the eks:eks-cluster-name tag | Create a storage class (2026-11-15) |
| Karpenter | Latest v1.15.2 (2026-11-12), v1.15.1 (2026-10-23), v1.14.3 LTS. NodePool karpenter.sh/v1; consolidationPolicy WhenEmpty / WhenEmptyOrUnderutilized (default) / Balanced; consolidateAfter defaults to 0s; budgets default to 10%; expireAfter defaults to 720h; interruption queue SQS + EventBridge | Karpenter Releases · Disruption (v1.15) (2026-11-15) |
| Cluster insights | Refreshes every 24 hours. You can run start-insights-refresh manually. Categories: UPGRADE_READINESS and ROLLBACK_READINESS (7 days after upgrade). Error = impacts N+1; Warning = impacts N+2 and later. Use list-insights --filter and describe-insight | Cluster insights · View insights (2026-11-15) |
| Node ECR permissions | The Auto Mode node role uses AmazonEKSWorkerNodeMinimalPolicy + AmazonEC2ContainerRegistryPullOnly | Verified in Docker hour 4 · Auto Mode with AWS CLI (2026-11-15) |
Video verification notes
The titles and channels of the following videos were checked through the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json, verified on 2026-11-15): AWS Events “AWS re:Invent 2024 - Automate your entire Kubernetes cluster with Amazon EKS Auto Mode (KUB204-NEW)” (a_aDPo9oTMo); AWS Events “AWS re:Invent 2025 - Amazon EKS Auto Mode: Evolving Kubernetes ops to enable innovation (CNS354)” (v9i5L37PmtE); AWS Developers “Amazon EKS Auto Mode | Fully Automated Kubernetes Clusters” (s9d61eYkGzs); TechWorld with Nana “AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way” (p6xDCz00TxU); Containers from the Couch “How Amazon VPC CNI for k8s works” (RBE3yk2UlYA); “EKS Pod Identity vs IRSA | Securely Connect Kubernetes Pods to AWS Services” (aUjJSorBE70); “Amazon EKS Extended Support Explained” (_dJdAZ_J_jw). Durations and upload dates have not been verified. No videos with verifiable IDs were found for LBC / Gateway API, EBS/EFS/ASCP, the Karpenter topic, or troubleshooting and cleanup, so only storyboard scripts are provided for those. All videos are in English, and some were recorded before the current version, so for details rely on this hour and the official documentation.
Voice narration notes
The “Voice” tab reads the narration aloud using the browser's Web Speech API (en-US). English terms are pronounced with the en-US voice. The result depends on the speech voice packs installed on your operating system. This course could not call a TTS service while it was being generated, so no MP3 is embedded. You can hand the narration script directly to Amazon Polly or another tool to generate audio.
Known limitations
- The account IDs, ARNs, IPs, instance IDs, volume IDs, DNS names, platform versions (eks.N), patch numbers and durations in the “Expected output” sections are sample values. The AWS CLI output structure may change with CLI versions.
- Costs are order-of-magnitude estimates for ca-central-1, except the EKS control plane at 0.10 USD per hour. The AWS pricing page and the Pricing Calculator are authoritative.
- The times, instance type choices and IP numbers in the animations are illustrative. They explain the mechanism and are not benchmarks.
- The following content is based on the official documentation but could not be tested in this environment. It has been handled conservatively and is marked “see the official docs”: Auto Mode support for Gateway API and Security Groups for Pods; the LBC Gateway API GatewayClass controllerName and CRD file path; nftables mode support in the kube-proxy add-on; how ASCP is installed as an EKS add-on; whether Auto Mode includes metrics-server; NodeDiagnostic fields; the exact CLI for version rollback; the exact default values of the built-in Auto Mode NodePool (such as expireAfter); the exact price of extended support; and AMP managed collector parameters.
- The maximum Auto Mode node lifetime of 21 days, the built-in NodePool defaults and similar values may change as AWS updates the service. Use your cluster's actual output as the reference.
- The hour 8 materials were written in parallel with this hour. For cross-hour references, the final content of each hour takes precedence.