Home / AWS

AWSRunbookAdvanced

Sev1: EKS nodes go NotReady after a VPC CNI add-on update - find the cause and roll back

After updating the Amazon VPC CNI add-on, aws-node pods crash, nodes turn NotReady and new pods cannot get IPs. Find what broke, restore the CNI and update it safely next time.

Deepak Bhardwaj6 min read

Applies toAmazon EKS (Kubernetes 1.29+), Amazon VPC CNI plugin as an EKS add-on or self-managed, kubectl, AWS CLI v2

Symptoms

  • Shortly after an update-addon for vpc-cni, a Terraform apply, or an EKS version upgrade, nodes flip to NotReady.
  • kubectl describe node shows a condition like container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized.
  • aws-node pods in kube-system are in CrashLoopBackOff, Init:Error or not ready.
  • New pods stay in ContainerCreating with failed to assign an IP address to container. Pods already running may keep working until they restart.

Step 1: confirm the CNI is the cause (5 minutes)

kubectl get nodes -o wide
kubectl -n kube-system get ds aws-node -o wide
kubectl -n kube-system get pods -l k8s-app=aws-node -o wide

Read the logs from a failing pod, both the init container and the main container:

POD=$(kubectl -n kube-system get pods -l k8s-app=aws-node -o jsonpath='{.items[0].metadata.name}')
kubectl -n kube-system logs $POD -c aws-vpc-cni-init --tail=50
kubectl -n kube-system logs $POD -c aws-node --tail=100
kubectl -n kube-system describe pod $POD | sed -n '/Events/,$p'

Check what EKS thinks the add-on looks like:

CLUSTER=prod-eks
aws eks describe-addon --cluster-name $CLUSTER --addon-name vpc-cni \
  --query "addon.{version:addonVersion,status:status,issues:health.issues,role:serviceAccountRoleArn,config:configurationValues}"

Step 2: match the error to the cause

Log or event message Likely cause Fix
AccessDenied or UnauthorizedOperation on ec2:AssignPrivateIpAddresses, CreateNetworkInterface Add-on update dropped the IRSA role or Pod Identity association; CNI now uses a node role without AmazonEKS_CNI_Policy Re-attach the role (Fix B)
failed to get credentials, IMDS timeouts No role on the service account and IMDS blocked or hop limit 1 Re-attach the role
ipamd cannot reach ec2.<region>.amazonaws.com Private cluster without an EC2 interface endpoint, or proxy settings lost Restore endpoint or proxy env vars
Pods get IPs from the wrong subnets, or none Custom settings such as AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG or ENABLE_PREFIX_DELEGATION reset to defaults by OVERWRITE Re-apply configuration values (Fix C)
ImagePullBackOff on aws-node Nodes cannot reach the regional ECR registry for the add-on image Check ECR endpoints, NAT, image URI
Only nodes on one AMI fail New CNI version incompatible with that node OS or kernel Roll back version (Fix A)

Two quick checks catch most cases:

kubectl -n kube-system get sa aws-node -o jsonpath='{.metadata.annotations}{"\n"}'
aws eks list-pod-identity-associations --cluster-name $CLUSTER --namespace kube-system \
  --service-account aws-node
kubectl -n kube-system get ds aws-node -o jsonpath='{range .spec.template.spec.containers[?(@.name=="aws-node")].env[*]}{.name}={.value}{"\n"}{end}' \
  | grep -E "CUSTOM_NETWORK|PREFIX_DELEGATION|WARM_|ENABLE_POD_ENI|HTTPS_PROXY|NO_PROXY"

Compare the output with your IaC or a healthy cluster.

Step 3: restore the CNI

Fix A: roll back to the previous add-on version

Find the version that was running before. The UpdateAddon event in CloudTrail has it, or check your IaC history.

aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=UpdateAddon \
  --start-time $(date -u -d '-1 day' +%FT%TZ) \
  --query "Events[].[EventTime,Username,CloudTrailEvent]" --output text | grep -o '"addonVersion":"[^"]*"'

List versions valid for your cluster's Kubernetes version:

K8S=$(aws eks describe-cluster --name $CLUSTER --query "cluster.version" --output text)
aws eks describe-addon-versions --addon-name vpc-cni --kubernetes-version $K8S \
  --query "addons[].addonVersions[].addonVersion" --output text

Apply the earlier version, keeping the role and your configuration:

aws eks update-addon --cluster-name $CLUSTER --addon-name vpc-cni \
  --addon-version v1.19.2-eksbuild.1 \
  --service-account-role-arn arn:aws:iam::111122223333:role/prod-eks-vpc-cni \
  --configuration-values file://vpc-cni-config.json \
  --resolve-conflicts PRESERVE

The version string above is an example; use the one from your CloudTrail or IaC. Track the update:

aws eks list-updates --name $CLUSTER --addon-name vpc-cni
aws eks describe-update --name $CLUSTER --addon-name vpc-cni --update-id <id>
kubectl -n kube-system rollout status ds/aws-node --timeout=10m

Caution

If prefix delegation is enabled and prefixes are already assigned to ENIs, do not downgrade the VPC CNI below 1.9.0. AWS says you must replace the nodes if you do. Check ENABLE_PREFIX_DELEGATION before rolling back across that boundary.

Fix B: re-attach the IAM role

If the role was lost, rolling back is not needed. Attach it again with either IRSA or EKS Pod Identity, whichever your cluster uses:

# IRSA
aws eks update-addon --cluster-name $CLUSTER --addon-name vpc-cni \
  --service-account-role-arn arn:aws:iam::111122223333:role/prod-eks-vpc-cni --resolve-conflicts PRESERVE

# Pod Identity
aws eks create-pod-identity-association --cluster-name $CLUSTER --namespace kube-system \
  --service-account aws-node --role-arn arn:aws:iam::111122223333:role/prod-eks-vpc-cni

The role needs the AmazonEKS_CNI_Policy managed policy (plus the IPv6 policy if your cluster is IPv6). Restart the DaemonSet so pods pick up the credentials:

kubectl -n kube-system rollout restart ds/aws-node

Fix C: re-apply lost configuration

Put your settings in a configuration values file and apply it. Check the schema for your version first, because supported keys differ between versions:

aws eks describe-addon-configuration --addon-name vpc-cni --addon-version v1.19.2-eksbuild.1 \
  --query configurationSchema --output text | python -m json.tool | head -80
{
  "env": {
    "ENABLE_PREFIX_DELEGATION": "true",
    "WARM_PREFIX_TARGET": "1",
    "AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG": "true",
    "ENI_CONFIG_LABEL_DEF": "topology.kubernetes.io/zone"
  }
}
aws eks update-addon --cluster-name $CLUSTER --addon-name vpc-cni \
  --configuration-values file://vpc-cni-config.json --resolve-conflicts OVERWRITE

Warning

--resolve-conflicts OVERWRITE replaces any field EKS manages with its default unless you pass it in --configuration-values. That is how manual kubectl set env changes on aws-node disappear during updates. Always pass your full configuration file with it.

Step 4: recover the workloads

Once aws-node is ready on every node, nodes should return to Ready on their own. Then clean up:

kubectl get nodes
kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
kubectl get pods -A | grep -E "ContainerCreating|CrashLoopBackOff" | awk '{print "-n "$1" "$2}' | xargs -r -L1 kubectl delete pod

If a node stays NotReady after 10 minutes with a healthy aws-node pod, cordon, drain and replace it rather than debugging it during the incident.

Prevent it next time

  • Update the CNI one minor version at a time, on a non-production cluster first, and soak for a day.
  • Manage the add-on only in IaC with the version, role and full configurationValues set explicitly. Never patch aws-node with kubectl.
  • Use PRESERVE for routine updates and review the diff before using OVERWRITE.
  • Pin the add-on version. Do not let pipelines pick "latest" automatically.
  • Alert on the DaemonSet. Page when aws-node desired and ready counts differ for more than five minutes, or when nodes report NetworkPluginNotReady.
  • Keep a written note of the last good version in the runbook for each cluster so rollback does not depend on CloudTrail searches.