Summary
When you start using NetworkPolicy on Amazon EKS, the manifests look almost exactly like they do anywhere else in Kubernetes. The differences show up around them: in the VPC CNI settings that actually enforce the rules, and in how you deliver and operate the policies. My talk focused on exactly that "surrounding" part.
This article digs deeper into that talk. On stage I had to rush through how this works in day-to-day operations and how to ship policies with CI/CD, so here I have rebuilt those parts around diagrams. Everything reflects the state of things as of November 2026. The original slides (in Japanese) are here:
Who this is for
I wrote this for people who want to understand networking on EKS, and for anyone about to roll out NetworkPolicy. If you have used NetworkPolicy in Kubernetes before but wonder what is different on EKS, I hope this helps. If you are designing a way to deliver policies through CI/CD, the examples in the second half should be a useful starting point.
What you will take away
There are two things I would like you to take away. First, NetworkPolicy on EKS is written almost exactly as in upstream Kubernetes, and the differences come from VPC CNI settings and operations. Second, when you run it on AWS, managing how manifests and add-on settings are deployed is the part that really matters. The second half shows a setup and configuration examples for that.
What this article covers (and what it does not)
| Covered | Not covered |
|---|---|
| Using EKS and VPC CNI built-in features | Comparison with Kubernetes on other clouds |
| Real-world usage and CI/CD examples | Deep dives into third-party CNIs such as Calico or Cilium |
| What to watch out for in operations | Service mesh and L7 control |
| Detailed feature testing (planned for a separate article) |
I focus on the standard features of EKS and VPC CNI. Calico and Cilium are only mentioned by name, and any comparison is limited to AWS container services. Detailed testing, such as how each enforcement mode behaves, will come in a separate article.
Background
I assume you know Kubernetes Pods, Namespaces and Services, plus the basics of EKS nodes and add-ons. Before getting into EKS-specific topics, here is a short refresher on NetworkPolicy itself. Keeping these points in mind will make the rest of the article much easier to follow.
NetworkPolicy is the standard Kubernetes resource for restricting Pod-to-Pod traffic at L3/L4. Without any policy, every Pod can reach every other Pod. As soon as a policy selects a Pod, only the traffic you explicitly allow gets through. Policies are a union of allow rules, so there is no deny rule. And the thing that actually blocks traffic is the CNI. If the CNI does not support NetworkPolicy, writing one has no effect.
On EKS, VPC CNI plays that enforcing role. When you apply a NetworkPolicy, a controller on the control plane side creates a resource called PolicyEndpoint. The node agent on each node picks it up and uses eBPF to allow or deny traffic per Pod. EKS manages PolicyEndpoint for you, so you should never edit it by hand.
The main part: settings to get right on EKS
In the talk I split the AWS-specific settings that are easy to miss into five areas. Here I pick the three that trip people up most often. None of them is hard to configure, but if you do not know about them, you can easily end up in a state where "I wrote the policy, but it does nothing."
1. Enabling it, and choosing a mode
The first thing that is easy to miss: the network policy feature is off by default. Unless you set enableNetworkPolicy in the VPC CNI add-on configuration, applying a manifest raises no error and all traffic keeps flowing. I think this is the single most important thing to check when you start.
In the default standard mode, all traffic is allowed for a short time between Pod start and policy enforcement. If you want to close that gap, choose strict mode, but then every Pod starts with all traffic denied. Unless you allow the traffic you need, CoreDNS included, ahead of time, Pods cannot even resolve names. If you use Security Groups for Pods, stay on standard mode.
2. Where it does not apply
| Limitation | What it means |
|---|---|
| EC2 Linux nodes only | Not enforced on Fargate or Windows nodes |
| IPv4 or IPv6 | Only rules for one of the two take effect |
| eth0 only | Extra interfaces (for example via Multus) are not covered |
| Match ports | The policy port must match the container port, not the Service port |
| 24 per CIDR | Limit on port and protocol combinations per CIDR |
| Standalone Pods | Pods managed by Deployments and similar controllers are assumed |
Even with identical manifests, there are places where policies do not apply. All of these limits are listed in the Considerations section of the EKS User Guide. Two of them in particular tend to bite during migrations: policies are not enforced on Fargate, and the policy port has to match the container port. I recommend reading through the list once before rolling policies out to an existing cluster.
3. ClusterNetworkPolicy (cluster-wide rules)
ClusterNetworkPolicy, added in December 2025, lets you define cluster-wide rules that are evaluated before any namespace policy. A deny in the Admin tier cannot be overridden from a namespace. With Pass, you can hand the decision down to the namespace NetworkPolicy instead. Rules that the whole company must follow are much easier to manage when they live here.
The next example is a shortened version of one from the AWS Containers Blog. It blocks traffic to IMDS across the whole cluster. If some Pods still rely on the node's instance role, they will break as well, so it is safest to finish moving them to IRSA or EKS Pod Identity first.
# cluster/block-imds.yaml
apiVersion: networking.k8s.aws/v1alpha1
kind: ClusterNetworkPolicy
metadata: { name: block-imds }
spec:
tier: Admin
priority: 10
subject: { namespaces: {} }
egress:
- action: Deny
to: [{networks: [169.254.169.254/32]}]
Note: ClusterNetworkPolicy is an AWS-specific alpha API. Upstream, SIG Network is developing a resource with the same name under a different API group. For now I think the realistic approach is to keep these rules to a minimum and be ready to rewrite them later.
About testing
I plan to cover detailed testing in a separate article. I want to share hands-on results, such as how traffic right after Pod start differs between standard and strict mode, and whether policies really do nothing on Fargate nodes. This article stays focused on usage and operations.
Real-world usage
From here, I turn the practices from the second half of the talk into something more concrete. The slides only had room for an architecture diagram, so this article goes further, with usage examples and configuration. Please adapt the examples to your own environment as you read.
1. Protect one app, flow by flow
Take an e-commerce site made of front and api as an example. It becomes much easier to reason about if you protect Pod-to-Pod traffic with NetworkPolicy and traffic to AWS resources inside the VPC, such as RDS, with Security Groups. Trying to cover everything with NetworkPolicy alone tends to produce too many rules to read. Things the whole company wants blocked, like IMDS, go to the Admin tier.
2. Who owns what
I find that deciding ownership matters just as much. If the platform team owns the Admin tier and app teams own everything inside their namespaces, it is clear who to ask when traffic stops. When this stays vague, both over-blocking and over-opening become hard to notice.
3. When a new namespace is created
Things stay consistent if you decide up front that every new namespace gets four things: default deny, DNS access, an IMDS block, and a label design. If ClusterNetworkPolicy selects its targets by label, new namespaces are covered automatically as they are created. Even as teams grow, the manual work does not.
# namespaces/shop/00-baseline.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: default-deny, namespace: shop }
spec:
podSelector: {}
policyTypes: [Ingress, Egress]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: allow-dns, namespace: shop }
spec:
podSelector: {}
policyTypes: [Egress]
egress:
- to:
- namespaceSelector:
matchLabels: { kubernetes.io/metadata.name: kube-system }
podSelector:
matchLabels: { k8s-app: kube-dns }
ports:
- { protocol: UDP, port: 53 }
- { protocol: TCP, port: 53 }
Default deny and DNS access ship as per-namespace manifests through Argo CD. If you forget the DNS rule, it combines with default deny and stops even name resolution. That looks like an application error and is hard to trace back, so I recommend always shipping these two together.
4. Ship it with CI/CD
In this setup, policies and the VPC CNI add-on settings live in the same Git repository. Argo CD, provided by EKS Capabilities, syncs NetworkPolicy and ClusterNetworkPolicy from Git. The Argo CD control plane runs on the AWS side, so it does not consume worker node resources, which is a nice bonus. Add-on settings are applied from CI with Terraform and are never changed by hand.
Note: The configuration examples below are based on the specifications as of November 2026. They were not run as-is in a real environment, so check each tool's documentation before using them.
Repository layout
In this example, directories are split by who reviews them. The Admin tier rules and the add-on settings have a wide blast radius, so CODEOWNERS requires approval from the platform team. App teams only touch their own namespace directory, which I expect also shortens the wait for reviews.
# .github/CODEOWNERS
/cluster/ @your-org/platform-team
/addons/ @your-org/platform-team
/policy/ @your-org/platform-team
/.github/ @your-org/platform-team
Pipeline flow
In CI, a tool such as OPA checks that NetworkPolicies exist, and connectivity tests confirm both the traffic that should pass and the traffic that should be blocked. If you only test what should pass, you will never notice that something is too open. Decision logs go to CloudWatch Logs, and Container Network Observability visualizes the traffic.
Add-on settings (Terraform)
# addons/vpc-cni.tf
resource "aws_eks_addon" "vpc_cni" {
cluster_name = var.cluster_name
addon_name = "vpc-cni"
configuration_values = jsonencode({
enableNetworkPolicy = "true"
nodeAgent = {
enablePolicyEventLogs = "true" # emit decision logs (where traffic was blocked)
}
})
}
Checks and tests on pull requests (GitHub Actions)
# .github/workflows/netpol-ci.yaml
name: netpol-ci
on:
pull_request:
paths: ["cluster/**", "namespaces/**", "addons/**", "policy/**", "tests/**"]
permissions:
contents: read
jobs:
static-check:
runs-on: ubuntu-latest
steps:
# pin actions to a commit SHA in production
- uses: actions/checkout@v4
- name: Check labels and default-deny policies
run: |
docker run --rm -v "$PWD":/project -w /project \
openpolicyagent/conftest test namespaces/ cluster/ -p policy/
connectivity-test:
needs: static-check
runs-on: ubuntu-latest
environment: staging # lets you require approval
permissions:
contents: read
id-token: write # short-lived credentials via OIDC, no access keys stored
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.STG_DEPLOY_ROLE_ARN }}
aws-region: ap-northeast-1
- run: aws eks update-kubeconfig --name stg-cluster
- run: kubectl apply -R -f cluster/ -f namespaces/
- run: ./tests/connectivity.sh
AWS credentials come from OIDC as short-lived tokens, so no access keys are stored in the repository. The connectivity tests run against a staging cluster, so the workflow uses a GitHub environment to require approval. For production, pinning third-party actions to a commit SHA gives you extra peace of mind.
Check rules (Rego)
# policy/namespace.rego
package main
deny contains msg if {
input.kind == "Namespace"
not input.metadata.labels["security-tier"]
msg := sprintf("%s has no security-tier label", [input.metadata.name])
}
Connectivity tests
#!/usr/bin/env bash
# tests/connectivity.sh
set -euo pipefail
should_pass() { kubectl -n "$1" exec "$2" -- wget -q -O /dev/null -T 3 "$3" \
&& echo "OK pass : $1/$2 -> $3" || { echo "NG blocked: $1/$2 -> $3"; exit 1; }; }
should_block() { if kubectl -n "$1" exec "$2" -- wget -q -O /dev/null -T 3 "$3"; then
echo "NG not blocked: $1/$2 -> $3"; exit 1; else echo "OK blocked: $1/$2 -> $3"; fi; }
should_pass shop deploy/front http://api:8080/healthz
should_block batch deploy/worker http://api.shop:8080/healthz
should_block shop deploy/api http://169.254.169.254/latest/meta-data/
A test for traffic that should be blocked has inverted logic: the command failing means the test passed. Combining set -e with ! can silently miss failures, so the script uses an explicit if. It is an unglamorous detail, but if this breaks, you will never notice that something you think is blocked is actually open.
Syncing with Argo CD
# argocd/netpol-shop.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: netpol-shop
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/your-org/platform-netpol.git
targetRevision: main
path: namespaces/shop
destination:
name: prod-cluster # cluster registered in EKS Capabilities
namespace: shop
syncPolicy:
automated: { prune: true, selfHeal: true } # revert manual changes automatically
With selfHeal enabled, any policy changed directly with kubectl is reverted to what Git says. The "no manual changes" rule is enforced by tooling instead of relying on people being careful. Even when you need a temporary change during an incident, sending a pull request to Git leaves a history behind.
5. When someone says "it can't connect"
In operations, "it can't connect" is the request you will hear more and more. Working through the checklist from the top lets you narrow down which layer is blocking. The first item, "is it enforced at all?", is easy to overlook, so I recommend checking the add-on settings before suspecting the policies themselves.
6. What to watch out for in operations
| Challenge | What happens | What to do |
|---|---|---|
| Gap right after Pod start | Traffic is allowed until the policy applies | strict mode plus a DNS rule |
| Inconsistent labels | Holes open up, or traffic stops | Naming rules and CI checks |
| Poor visibility | Hard to tell where traffic stopped | Decision logs and visualization |
| IPs for external targets | Cannot follow AWS IP changes | SG for Pods or FQDN rules |
| Alpha API | Future rewrites | Keep rules to a minimum |
| Ownership | Unclear responsibilities | Platform team owns the Admin tier |
What makes operations hard, I feel, is that both over-blocking and over-opening are hard to see. Over-blocking surfaces as application errors, but over-opening causes nothing visible at all. That is exactly why I think it is important to build in decision logs and connectivity tests from day one.
Wrap-up and what's next
You write NetworkPolicy on EKS the same way as in Kubernetes, and the differences come from VPC CNI settings and operations. Start with the four basics, default deny, DNS access, an IMDS block and a label design, and manage policies and add-on settings through the same pipeline. Splitting responsibilities between NetworkPolicy, Security Groups and the Admin tier keeps the rules readable.
Since ClusterNetworkPolicy is an AWS-specific alpha API, I plan to keep following its changes alongside the upstream work. Over the past year, AWS has kept adding network control and visibility features, and I feel there is still a lot of room to grow operations that combine decision logs and visualization. Next, I will write up the testing I could not cover here in a separate article.
References
- Talk slides: Amazon EKS network policies, implementation practices (Japanese)
- Limit Pod traffic with Kubernetes network policies
- Restrict Pod network traffic with Kubernetes network policies
- Troubleshooting Kubernetes network policies
- Use Network Policies with EKS Auto Mode
- EKS Best Practices Guide (Network security)
- Amazon EKS introduces enhanced network security policies
- Enhance Amazon EKS network security posture with DNS and admin network policies
- ClusterNetworkPolicy v1alpha2 (Kubernetes SIG Network)
- Kubernetes Network Policies











Top comments (0)