Skip to main content
Source

This page is generated from skills/eks-security/references/workload-security.md. Edit the source, not this page.

Layer 3: Workload Security (Pod Security + Network)

Two compounding concerns: pod security posture (what a pod is allowed to do) and network policy (what a pod is allowed to talk to).

Pod security: three layers that compound​

3a: Pod Security Admission (PSA, Kubernetes-native)
restricted profile → MOST WORKLOADS (default for new namespaces)
baseline profile → workloads needing limited extra privileges
privileged profile → AVOID; only system / kube-system

3b: Custom policy engine (choose ONE)
Kyverno → Kubernetes-native, no Rego DSL; preferred for new adoption
OPA Gatekeeper → Rego-based; for teams with existing OPA/Rego expertise

3c: Image admission control (a sub-rule of 3b)
Kyverno image rule → block unsigned / high-severity images at admission
(ImageValidatingPolicy; the legacy ClusterPolicy verifyImages is deprecated)
(AWS Signer signatures: built-in verification cannot verify them; use the
kyverno-notation-aws extension on Kyverno v1.11 to 1.19.x, else Gatekeeper + Ratify,
see image-supply-chain.md)
  • PSA restricted is the default recommendation for production namespaces. Roll out in audit mode first, confirm no workloads break, then switch to enforce.
  • Kyverno is preferred for new adoption (Kubernetes-native YAML policies, no Rego). OPA Gatekeeper suits teams already invested in Rego/OPA. Both are CNCF.
  • Run the policy webhook highly available. A webhook whose failurePolicy is Fail (the Kubernetes default, and the default for Kyverno policies) rejects every request it matches while its pods are unreachable, so with the default single replica, one down Kyverno pod can block new pods that its policies match. Kyverno's default install runs a single replica per Deployment; for HA set admissionController.replicas=3 (Kyverno's own example). With replicas > 1 its Helm chart enables a PodDisruptionBudget, and by default it leaves kube-system and its own namespace out of its webhooks. The OPA Gatekeeper chart defaults its validating webhook to Ignore: a down Gatekeeper admits requests unchecked, so choose fail-open or fail-closed on purpose. References: Admission webhook failure policy · Kyverno HA install · Kyverno policy settings · Kyverno chart values · Gatekeeper chart values.
  • PodSecurityPolicy (PSP) was removed in Kubernetes 1.25+: clusters on 1.25+ have no PSP. PSA + Kyverno/OPA is the canonical replacement. Do not recommend PSP.

References: Pod Security Admission (Kubernetes) · Pod Security Standards · aws/aws-eks-best-practices OPA policies · Kyverno policy library.

Network policy on EKS: VPC CNI is now native​

  • VPC CNI native NetworkPolicy: the AWS VPC CNI enforces standard Kubernetes NetworkPolicy without a third-party CNI. Default-deny on production namespaces, then allowlist required ingress/egress. Reference: Limit pod traffic with Kubernetes network policies.
    • Pod Identity egress carve-out. Pods that use EKS Pod Identity get credentials from the node's Pod Identity Agent on the link-local address 169.254.170.23 (IPv4) or [fd00:ec2::23] (IPv6). A default-deny egress policy must allow 169.254.170.23/32 and fd00:ec2::23/128 (TCP 80) so those pods can still reach their credentials. Pods behind a proxy also need both addresses in no_proxy/NO_PROXY; write the IPv6 one without brackets (fd00:ec2::23): Go and curl do not match the bracketed form the AWS page shows. References: EKS Pod Identity considerations · How EKS Pod Identity works.
  • Enhanced capabilities (current versions matter). EKS added cluster-wide enforcement via ClusterNetworkPolicy and FQDN-based egress policies (filter egress to cluster-external destinations by domain name). Availability specifics, framed precisely: the managed add-on with these features is offered for Kubernetes 1.30+ at v1.22.3 (a practical packaging constraint, not a hard API gate, the base NetworkPolicy prerequisites still list 1.26.7/1.27.4); use VPC CNI v1.22.3+ for these features (the fixed release in AWS security bulletin 2026-170), and check the installed version against open advisories with cve-advisory-review.md rather than a version pinned here; ClusterNetworkPolicy works in all cluster launch modes, while DNS/FQDN-based policies are supported only on EKS Auto Mode-launched EC2 instances. References: Enhanced network security policies (Dec 2025) · Enhanced network policy capabilities · DNS and Admin Network Policies.
    • CRD specifics. Both CRDs live in apiGroup networking.k8s.aws/v1alpha1 (alpha, AWS's own group, not upstream policy.networking.k8s.io). ClusterNetworkPolicy is supported from VPC CNI v1.21.0 (EKS User Guide), but v1.21.0's network policy agent is defective (fixed in v1.21.1); run v1.22.3+ as above. ApplicationNetworkPolicy comes with EKS Auto Mode. ClusterNetworkPolicy is cluster-scoped with a tier: Admin | Baseline field (the Admin tier is evaluated first and cannot be overridden by namespace policies; Baseline is an overridable default). ApplicationNetworkPolicy is a namespaced EKS Auto Mode CRD that supports all standard NetworkPolicy fields and adds an FQDN-based egress filter; the FQDN egress applies only on Auto Mode nodes. Egress policies must allow TCP and UDP port 53 to the CoreDNS service IP or DNS and FQDN filtering breaks.
    • AWS Network Firewall rules by pod (since 30 June 2026).
      • How it works. A Network Firewall container association tracks the IPs of running pods in an EKS cluster as a dynamic IP set, which a stateful rule group references as an IPSet variable, so egress rules can target "these pods" instead of fixed IPs, including domain filtering for those pods (TLS SNI or HTTP Host), which with VPC CNI network policies otherwise needs Auto Mode nodes. A pod can fake SNI or Host, so where that matters also write IP rules, or add the aws_route_53_resolved_domain keyword to the pod rule, which matches the domain the destination IP was resolved for. It needs resolved IP validation on the firewall policy, and that setting itself acts on every connection to an IP that was not resolved in the firewall endpoint's Availability Zone, so each client must reach the endpoint in its own zone (a firewall attached directly to a transit gateway, which AWS calls a transit gateway-attached firewall, is the exception: it validates against the client's zone). Start resolved IP validation with Action ALERT for about 24 hours before switching to DROP or REJECT, and during that period confirm the firewall's DnsAzUnavailableFlows metric stays zero (it reports only nonzero values). If it is not zero, keep Action ALERT on that firewall until its traffic is served from a supported zone, and add the keyword rule only once the metric is zero: in a zone without the feature that rule drops the traffic it inspects, whatever the validation Action or the rule's own action. For EKS, attribute filters select by namespace and Kubernetes labels; one association holds up to 5 monitoring configurations, each naming one cluster ARN. The association only collects IPs from pod lifecycle events and has no part in the data path; the firewall endpoints in the VPC do the inspection.
      • Prerequisites. The firewall must see the pod's own IP: with SNAT on, traffic arrives with the node IP and the rules do not match, so on clusters where you manage the VPC CNI, set AWS_VPC_K8S_CNI_EXTERNALSNAT=true on Linux nodes in private subnets, with SNAT done by a NAT gateway (Windows cannot disable SNAT; on IPv6 clusters egress to IPv4 is SNATed to the node IP, and the Network Firewall page does not cover IPv6). The Network Firewall page does not mention EKS Auto Mode (whose SNAT setting is the NodeClass snatPolicy), so check Auto Mode support with AWS before relying on it. Only traffic your route tables send through a firewall endpoint is inspected, so route the pod subnets through the firewall endpoints (pod subnet, then firewall endpoint, then NAT gateway). The cluster must be in the same Region and account as the container association. Creating one needs network-firewall:CreateContainerAssociation (on the association and each cluster ARN), eks:DescribeCluster and, the first time, iam:CreateServiceLinkedRole. Quotas: 100 container associations per account per Region (adjustable); 5 monitoring configurations per association and 30 container association references per rule group (both fixed). A container association that a rule group references cannot be deleted (InvalidOperationException); remove the references first. IaC: CloudFormation AWS::NetworkFirewall::ContainerAssociation; Terraform aws_networkfirewall_container_association (AWS provider v6.59.0+).
      • Rule design. Strict-order stateful rule groups keep evaluation order predictable, but strict order has no implicit deny, so give the policy a default action of Drop established or either Application drop established action (Drop established drops all UDP and ICMP, so pass DNS, NTP and other UDP first); the default action applies to all traffic through the firewall, so pass node and other non-pod traffic first. A rule group cannot mix container associations with regular IP sets or prefix lists. Pod-to-pod and same-node traffic never reaches the firewall, so keep it on NetworkPolicy and ClusterNetworkPolicy.
      • References: Container associations · How Network Firewall works · Rule evaluation order · Outbound access for Pods (external SNAT).
  • EKS Auto Mode supports NetworkPolicy out of the box. Reference: Network policies with EKS Auto Mode.
  • Cilium CNI: not supported on EKS Auto Mode (Auto Mode supports no alternate CNI or network-policy plugins, checked 2026-11-05); available on self-managed / managed node groups for advanced features (eBPF, Hubble, Cluster Mesh).

Security Groups for Pods (SGP)​

For compliance workloads needing network-layer isolation between pods (e.g., PHI-handling pods isolated from non-PHI pods in the same cluster), attach VPC Security Groups at pod granularity via the VPC CNI trunk/branch-ENI feature. Reference: Leveraging CNI custom networking alongside Security Groups for Pods.

SGP limitations, material for a compliance design (don't promise isolation it doesn't deliver). Per Security groups for Pods:

  • Windows and EKS Auto Mode: this VPC CNI feature (vpcresources.k8s.aws/v1beta1) does not work on Windows nodes or Auto Mode nodes. On Kubernetes 1.36+, Auto Mode has its own SecurityGroupPolicy (eks.amazonaws.com/v1, see auto-mode-security.md); its manifests are not portable, and it enforces security groups on same-node Pod-to-Pod traffic (Security groups for Pods in Auto Mode). In a cluster with both kinds of nodes, per that page: "Neither enforces the other's policies, so a Pod that can be scheduled onto either kind of node needs a policy in both API groups to be secured on both." Below 1.36, Auto Mode offers only NodeClass podSecurityGroupSelectorTerms (one SG set per NodeClass).
  • (VPC CNI) Same-node traffic: in standard mode, pod SG rules are not applied to traffic between pods on the same node; the default strict mode does apply them but routes all pod traffic through the VPC, which breaks NodeLocal DNSCache and externalTrafficPolicy=Local.
  • No t-family instance support; trunk/branch ENIs reduce pod density per node. Combine SGP with Kubernetes NetworkPolicy (default-deny) rather than treating SGP alone as the isolation boundary.

In a security event, isolate the suspect pods with a pod-scoped NetworkPolicy by label, not a namespace deny-all: see security-event-response.md step 3.

Service-mesh mTLS (east-west encryption in transit)​

For intra-cluster pod-to-pod mTLS, use a service mesh, Istio (sidecar mode), Linkerd, or Cilium Service Mesh, all run on EKS and issue/rotate workload certificates for east-west traffic.

Don't position VPC Lattice as an mTLS mesh, it isn't one. VPC Lattice provides cross-VPC / cross-cluster service connectivity with IAM-based authentication (SigV4), not certificate-based mTLS between pods. Use it for secure cross-boundary service-to-service connectivity; use a service mesh (Istio/Linkerd/Cilium) for intra-cluster mTLS. References: VPC Lattice integration · VPC Lattice SigV4 auth.

Gotcha: AWS App Mesh reached end of support on September 30, 2026: after that date the console and App Mesh resources are no longer accessible (checked 2026-11-05 on the notice page). Do not recommend App Mesh; migrate existing meshes and use Istio/Linkerd/Cilium mesh or VPC Lattice. Reference: AWS App Mesh end-of-support notice.

Shared responsibility (Layer 3)​

AWS managesCustomer manages
VPC CNI + NetworkPolicy enforcement engine; PSA controller (built into the managed control plane); SGP trunk/branch ENI plumbingPSA profile labels per namespace; Kyverno/OPA policy authoring + rollout; NetworkPolicy rules (default-deny + allowlists); SGP assignment; service-mesh deployment + mTLS config

Sources​