- Newest
- Most votes
- Most comments
OK, it seems to be caused by the AWS_VPC_K8S_CNI_EXTERNALSNAT configuration on aws-node that I set to allow Fargate pods to access network.
answered 2 years ago
The issue you're experiencing with pods on EC2 nodes not having outbound network access, while the EC2 instances themselves can connect, is likely related to the network address translation (NAT) configuration for the pods. Here are a few points to consider and potential solutions:
-
By default, when a pod communicates with an IPv4 address outside of the VPC, the Amazon VPC CNI plugin translates the pod's IP address to the primary private IPv4 address of the node's elastic network interface. This translation might not be occurring correctly in your case.
-
Check if your Amazon VPC CNI plugin version is up to date. Older versions may have issues with network address translation for pods.
-
Ensure that the EC2 instances are in a public subnet and have a public or elastic IP address assigned. Pods can only communicate with internet resources if the node they're running on meets these criteria.
-
If your pods are in a private subnet and need to communicate outbound to the internet, you may need to adjust the CNI plugin configuration. You can do this by running the following command:
kubectl set env daemonset aws-node -n kube-system AWS_VPC_K8S_CNI_EXTERNALSNAT=true
This enables external source network address translation (SNAT) for pods.
-
If you're using custom networking to deploy pods in alternate subnets, ensure that the subnets and security groups for the pods are properly configured and are in the same VPC as the node.
-
If IPv6 is enabled for your cluster, the behavior might be different as IPv6 addresses are not network translated. In this case, ensure your VPC and subnet configurations support IPv6 traffic correctly.
If these steps don't resolve the issue, you may need to review your cluster's network configuration, including VPC settings, security groups, and network ACLs, to ensure there are no restrictions preventing pod traffic.
Sources
Enable outbound internet access for pods - Amazon EKS
Deploy pods in alternate subnets with custom networking - Amazon EKS
Configure the Amazon VPC CNI plugin for Kubernetes for security groups for Amazon EKS Pods - Amazon EKS
Relevant content
asked 4 years ago
asked 4 years ago
- AWS OFFICIALUpdated 3 years ago

I have reviewed all of them but didn't find any potential issues.