Containers and Kubernetes: could one compromised pod take over the cluster?

This month, take the API server off the internet, enforce the baseline Pod Security Standard in every app namespace after a dry run and start replacing Ingress NGINX, which has had no upstream security fixes since March 202613. Then judge every other setting by whether it stops one compromised pod from reaching its node, the cloud account or a more powerful service account.

Reviewed
Next review
Version
1.0
Written for
Platform, DevOps and security teams running Kubernetes on AKS, EKS, GKE or their own servers, from one cluster to many

If you only do five things

  1. Take the API server off the internet.

    EKS, AKS and GKE expose it by default192328. Make it private or admin-only: Microsoft finds exposed APIs, default credentials and unpatched images behind most container compromises18.

  2. Enforce Pod Security baseline in every app namespace.

    After a dry run, set the label enforce to baseline to block privileged containers, hostPath and host namespaces4, and warn and audit to restricted6. North Korea-linked UNC4899 broke out through a privileged infrastructure pod17.

  3. Treat pod creation as a privileged right.

    Anyone who can create pods in a namespace can mount its Secrets and run as any of its service accounts3. Each quarter, list who holds that right, cluster-admin or the rights below, and cut the list.

  4. Keep workload credentials short-lived.

    Set automountServiceAccountToken: false unless a pod calls the API2, avoid non-expiring token Secrets1 and block pods from the node's cloud role21. UNC4899 stole database credentials from a pod's environment variables17.

  5. Stay on a supported version, add-ons included.

    Kubernetes patches only its three newest minor versions, for about a year each10. Ingress NGINX, in about half of cloud native environments, can read every Secret by default and was retired in March 2026121113.

Harden a running cluster in this order

  1. Who can reach and administer it?

    List each cluster's endpoint, version, add-ons and cluster-admin bindings. Find Ingress NGINX with kubectl get pods -A -l app.kubernetes.io/name=ingress-nginx12.

  2. Which pods would Pod Security reject?

    Label namespaces with --dry-run=server to list pods that would fail6, and set the warn and audit labels first. They also check Deployments, while enforce checks only pods, so a noncompliant Deployment is accepted but its pods are rejected5.

  3. Does your network plugin enforce NetworkPolicy?

    If not, a NetworkPolicy has no effect. Namespace by namespace, allow the traffic you need, DNS included, then add default-deny ingress and egress policies8.

  4. What does Pod Security miss?

    Add admission rules for image sources and digests1; signing is in the supply-chain sheet. ValidatingAdmissionPolicy is built in and can Warn and Audit before it denies7; Kyverno and OPA Gatekeeper are add-ons4.

  5. Would you see a takeover?

    Turn on audit logs: they are off by default on EKS20 and need a diagnostic setting with kube-audit on AKS25. Alert on exec into pods, new cluster role bindings and Secrets listed by people. Retention is in the logging sheet.

Defaults to change on EKS, AKS and GKE

Amazon EKS

  • Public endpoint. Enable private access, then limit or disable public access19.
  • aws-auth. Deprecated: move to access entries and remove the creator's cluster-admin21.
  • Support. 14 months, then 12 of paid extended support, on by default. Extended support for 1.31 ends on 26 November 202622.

Azure AKS

  • Public API server. Use a private cluster or at least authorized IP ranges23.
  • Local accounts. On by default and unaudited. Move tools off --admin, set --disable-local-accounts and rotate certificates off-hours24.
  • Support. 12 months per version; 1.34 reaches end of life in November 202626.

Google GKE

  • Reachable control plane. Use only the DNS-based endpoint, or authorized networks28.
  • Anonymous access. Set --anonymous-authentication-config=LIMITED on clusters created before 1.35.0-gke.117100028.
  • Upgrades. Use a release channel with accelerated patch auto-upgrades28.

What changed in 2026

  • Ingress NGINX is retired. Upstream has had no fixes since 24 March 202613; AKS patches its managed NGINX add-on only through November 202627. Move to Gateway API or another controller12.
  • Kubernetes 1.36 closed old gaps. It disabled gitRepo volumes for good and deprecated Service externalIPs13.
  • AKS will upgrade unsupported clusters itself. From 1 June 2027, then 60 days after each version's end of life, ignoring maintenance windows26.
  • Linux root exploits came with public code. Three flaws disclosed from 29 April to 13 May 2026 gave local users root on major distributions18. Patch node images within the patching sheet's deadlines.

RBAC rights that allow escalation

  • get, list or watch on Secrets. List and watch return the contents too3.
  • escalate, bind and impersonate. They bypass RBAC's escalation checks or borrow another user's rights3.
  • Any right on nodes/proxy. Even get runs commands in every pod on the node, unaudited and past admission control3.
  • Webhook, token and volume rights. Control of webhook configurations, or create on serviceaccounts/token or PersistentVolumes, exposes admitted objects, mints tokens or mounts the node's disk3.
  • patch on namespaces. It lets a user relabel a namespace to a looser Pod Security level3.

Pod and node settings that stop an escape

  • Non-root, read-only, no escalation. Restricted requires runAsNonRoot, no privilege escalation, seccomp and dropping ALL capabilities4. Add readOnlyRootFilesystem2.
  • User namespaces. Set hostUsers: false, GA on Linux since 1.36, to map container root to an unprivileged host user14.
  • Minimal images by digest. Ship no shells or debug tools, pin sha256 digests instead of tags and scan at build and deploy1.
  • Secrets as files. Environment variables may leak more easily; mount secrets from an external store with the Secrets Store CSI Driver1.
  • Kubelet API. On your own nodes, turn off --anonymous-auth and set --authorization-mode=Webhook: the defaults allow anonymous access9.

What you can skip

  • A service mesh just for encryption. The checklist suggests one only if your network plugin can't encrypt traffic1.
  • Waiting for fixes to old CVEs. Scanners can flag CVE-2020-8561, CVE-2020-8562 and CVE-2021-25740 on every version since June 2026; they won't be fixed15. Mitigate once and accept them.
  • CPU limits on every pod. They throttle work and can upset autoscaling; the checklist suggests them only for sensitive workloads1.

Mistakes that cost the most

  • Exempting a controller from Pod Security. Exempting the ReplicaSet controller exempts everyone who can create a Deployment5.
  • Giving CI cluster-wide rights. UNC4899 made CI jobs print service account tokens to logs, then used a highly privileged one to escalate17.
  • Binding roles to built-in groups. system:unauthenticated is anyone who can reach the API server3; on GKE, system:authenticated includes any Google account28.

What this looks like at your size

Small team, no security staff

  • Prefer a managed mode with secure defaults: GKE Autopilot blocks privileged pods by default29.
  • Limit the API server to your VPN or office addresses, and turn on audit logs.
  • Enforce baseline in every app namespace and turn on automatic patch upgrades.

Growing, with IT or security staff

  • Reach a private API server through a VPN or bastion, with SSO groups mapped to RBAC roles.
  • Keep admission and network policies in Git, and move each rule from warn to deny.
  • Upgrade one minor version every four months, as they ship26, staging cluster first.

Enterprise or regulated

  • Give each trust level its own namespace3 and untrusted tenants their own cluster.
  • On self-managed clusters, load must-have admission policies from disk, beta in 1.3716.
  • Send audit logs and GuardDuty, Defender for Containers or Falco alerts to the SIEM.