Amazon VPC CNI

Overview

The Amazon VPC CNI plugin assigns IP addresses from the VPC to each pod, providing native VPC networking. Unlike overlay CNIs (Cilium, Calico in overlay mode), VPC CNI pods appear as regular EC2 instances in your VPC - they have ENIs and IPs directly from your VPC CIDR.

Architecture

VPC CNI has two main components running in the aws-node DaemonSet:

ComponentContainerPurpose
CNI Pluginaws-cniWires up host/pod network stack when called by kubelet
ipamdaws-nodeLong-running daemon managing IP address allocation

CNI Plugin Flow

When kubelet creates a pod, it calls the CNI plugin to configure networking:

1. kubelet → CNI plugin (ADD command)
2. CNI plugin → ipamd (via Unix socket /var/run/aws-node/ipam.sock)
3. ipamd → EC2 API (Allocate address)
4. CNI plugin → configures veth pair, routes, iptables
5. Response back to kubelet

ipamd Daemon

The IP Address Management (IPAMD) daemon is responsible for:

  • Maintaining warm pool of ENIs and IP addresses
  • Tracking assigned/free IPs in /var/run/aws-node/ipam.json
  • Reconciling desired state with actual EC2 state

VPC Resource Controller

A separate controller (vpc-resource-controller) running on the EKS control plane handles:

  • Branch network interface attachment for Security Groups for Pods
  • Advertising branch ENIs as extended resources (vpc.amazonaws.com/pod-enis)

Pod Networking Flow

Pod ←→ veth0 (host) ←→ eth0 (node)
                          │
                     Primary ENI ←→ VPC
                          │
              Secondary IPs → assigned to pods

IP Limits by Instance Type

Instance TypeMax ENIsIPs per ENIMax Pods*
t3.medium3617
t3.large31027
m5.large31027
m5.xlarge41557
m5.2xlarge41557
c5.2xlarge41557
c5.4xlarge81557
r5.xlarge41557

* Max pods formula: (ENIs × IPs_per_ENI) - 1 + 2 for kubelet reserved IPs

Sub-commands for Debugging

# Check pod networking - list ENIs and IPs
kubectl exec -n kube-system aws-node-xxxx -- aws ec2 describe-network-interfaces \
  --filters "Name=tag:Name,Values=*-eni-*"
 
# Check ipamd state
kubectl exec -n kube-system aws-node-xxxx -- cat /var/run/aws-node/ipam.json
 
# View CNI logs
kubectl logs -n kube-system -l k8s-app=aws-node -c aws-cni
 
# View ipamd logs
kubectl logs -n kube-system -l k8s-app=aws-node -c aws-node
 
# Check introspection endpoint
kubectl exec -n kube-system aws-node-xxxx -- wget -O- 127.0.0.1:61679/stats
 
# Verify node max pods setting
kubectl get nodes -o custom-columns=NAME:.metadata.name,MAX_PODS:.status.capacity.pods

VPC CNI Version Requirements

Kubernetes VersionMinimum VPC CNI Version
1.35v1.21.1-eksbuild.8
1.34v1.21.1-eksbuild.8
1.33v1.21.1-eksbuild.8
1.32v1.21.1-eksbuild.8
1.31v1.21.1-eksbuild.8
1.30v1.21.1-eksbuild.8
1.29v1.21.1-eksbuild.8

References