Last updated: April 29, 2026
Kubernetes is where 2024-2026 cloud security action is happening. Every Indian fintech, every serious SaaS, and most mature enterprises now run workloads on Kubernetes. And Kubernetes, by design, has the most complex security surface of any modern platform. The control plane, the worker nodes, the network fabric, the service mesh, the supply chain, the secrets, and the workloads themselves — all of them need dedicated security thinking.
This module is the attacker’s-eye-view of Kubernetes combined with the defender’s hardening playbook. By the end you will:
- Understand the K8s control-plane components and which ones are high-value targets
- Know the standard privilege-escalation paths from a compromised pod to cluster admin
- Apply the CIS Kubernetes Benchmark mental model to real clusters
- Recognise supply-chain attack vectors specific to container images and Helm charts
- Use the mature tooling (kubescape, kube-bench, Falco, Trivy) to audit and monitor
Control plane — the crown jewels
The Kubernetes control plane runs on master nodes (or as a managed service in EKS/AKS/GKE). Key components:
- kube-apiserver — the gateway. Every component talks to it. If compromised, everything is compromised
- etcd — the cluster state database. Stores every Secret, ConfigMap, Pod spec. Read access = cluster credential dump
- kube-scheduler — decides which node a pod runs on
- kube-controller-manager — runs controllers (deployment, replication, node lifecycle)
- cloud-controller-manager — integrates with cloud provider APIs
All of these communicate via mTLS. Compromising any one typically means the cluster is lost. In managed clusters (EKS/AKS/GKE), the provider runs the control plane. For self-managed clusters, protect master nodes at Tier-0 level: no interactive access, dedicated subnet, MFA-required SSH, continuous patching.
Worker plane — where workloads run
- kubelet — node agent that manages containers. Has privileged credentials; has pod-exec capabilities
- kube-proxy — implements service networking (iptables or IPVS)
- container runtime — containerd, CRI-O; actually starts/stops containers
- CNI plugin — networking: Calico, Cilium, Flannel, etc.
- CSI plugin — storage provisioning
A pod that escapes its container into the node hits the kubelet — which has enough privileges to do almost anything. Container escape is therefore the primary attack vector on K8s.
The standard pod-to-cluster escalation path
Attackers with code execution in a single pod typically pursue this chain:
- Enumerate the pod’s own privileges — check the service account token at
/var/run/secrets/kubernetes.io/serviceaccount/token. Use it to query the API server: can this SA create pods, exec into other pods, read secrets? - Check for cloud metadata access — from a pod, can you reach the node’s Instance Metadata Service? In EKS, if IMDSv1 is available and the pod lacks egress restrictions, you can steal the node’s IAM role credentials. In AKS / GKE, similar flows exist via their respective metadata services
- Break out of the container if privileged — privileged pod or excessive capabilities (SYS_ADMIN, NET_ADMIN) enables kernel-level operations that escape container isolation
- Abuse misconfigured RBAC — default ClusterRoles like “edit” or “admin” granted to over-broad subjects
- Exec into other pods — if the compromised SA has pods/exec permission, attacker hops into other workloads and pivots
- Dump secrets — if SA has secret access, read all Secrets in the namespace (often contains database credentials, API keys, certificates)
- Escalate to cluster-admin via role binding manipulation, service-account-token theft from nodes, or etcd direct access
The speed from “compromised pod” to “cluster admin” on a poorly-configured cluster is minutes. On a well-configured cluster, it’s typically not possible — the escalation paths are closed.
Key security controls
Pod Security Standards (replacing PodSecurityPolicy)
PSS defines three namespaced profiles:
- Privileged — no restrictions. Reserved for trusted system workloads only
- Baseline — minimally restrictive; prevents known privilege escalation (no privileged, no hostNetwork, no hostPID, etc.)
- Restricted — highly hardened; drops all capabilities, requires non-root, readOnlyRootFilesystem, etc.
Label every namespace with the profile and enforcement mode:
apiVersion: v1
kind: Namespace
metadata:
name: app-production
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: v1.28
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
For anything more granular, use admission controllers like OPA Gatekeeper or Kyverno.
Network Policies
By default, all pods can talk to all other pods. NetworkPolicy resources enable pod-level firewalling. Every production namespace should have a default-deny ingress/egress policy, then specific allows.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
namespace: app-production
spec:
podSelector: {}
policyTypes: ["Ingress", "Egress"]
CNIs that support NetworkPolicy: Calico, Cilium, Weave. Flannel alone does not — need Cilium or Calico for enforcement in many production clusters.
For sophisticated workloads, Cilium’s CiliumNetworkPolicy supports L7-aware rules (HTTP method, path, Kafka topic, DNS). Service mesh (Istio, Linkerd) overlays mTLS authentication.
RBAC discipline
Default-deny is the mindset. Grant the minimum:
- Service accounts per workload (one SA per deployment)
- Role / RoleBinding at namespace scope, not ClusterRole / ClusterRoleBinding (cluster-wide)
- Verbs scoped: get/list/watch on specific resources, never
* - Resources scoped: specific resource names where possible
- No “system:masters” binding except for the cluster’s own admin
- Audit default ClusterRoles — “edit” and “admin” are extremely broad
Tools: kubectl auth can-i tests specific permissions. kubescape audits RBAC graph. Keep a diff of RoleBindings over time; alert on new cluster-admin-adjacent bindings.
Secrets management
K8s Secrets are base64-encoded, not encrypted at rest by default. Fixes:
- Enable etcd encryption at rest — configure EncryptionConfiguration in API server args
- External secret store — Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager, with a CSI driver or External Secrets Operator injecting runtime
- Sealed Secrets (Bitnami) — for GitOps patterns where Secrets need to be in git
- Never commit Secrets to git in plaintext; use the sealed/external patterns
Image supply chain
Container images carry the full stack — OS, libraries, your app. Supply chain concerns:
- Base image freshness — pin to digests, not tags. Rebuild regularly against patched bases
- Vulnerability scanning — Trivy, Grype, cloud-native scanners. Scan in CI; enforce policy (no high/critical CVEs in prod)
- Image signing — Cosign for supply-chain provenance. Reject unsigned images via admission policy
- Trusted registries only — block pulls from Docker Hub’s general public space; use your own or curated registries
- SBOM generation — automated for every image; useful for CVE response
Runtime detection
Static hardening is necessary but not sufficient. Runtime security tools:
- Falco — syscall-based runtime detection. Detects container escapes, privilege escalations, crypto mining, reverse shells. Open source, widely deployed
- Tetragon (Cilium) — eBPF-based observability and policy enforcement at the kernel level
- Cloud provider options — AWS GuardDuty EKS Runtime Monitoring, Azure Defender for Kubernetes, GCP Container Threat Detection
These catch what static controls miss — a legitimate pod that gets exploited and starts behaving oddly, a zero-day, an insider running unauthorised commands.
Common high-impact misconfigurations
- Privileged containers in production —
securityContext.privileged: truegives near-root on the host - Host path mounts —
hostPath: /mounts the host filesystem; trivial escape - hostNetwork / hostPID — container shares node’s network or process namespace; visibility into other workloads
- allowPrivilegeEscalation: true — setuid binaries can elevate; default unfortunately true
- Running as root —
runAsUser: 0or unset (uses image default, often root) - Mounted service account tokens on pods that don’t need them —
automountServiceAccountToken: falsefor pods not calling the K8s API - Default namespace abuse — everything in ‘default’ makes RBAC and policy impossible
- Kubelet exposed on the internet — shockingly common in misconfigured self-managed clusters
- etcd with no auth or on external interface — direct state-database access
- API server accessible from 0.0.0.0/0 — restrict by IP allow-list or private cluster mode
- No audit logging — API server audit logs disabled or undirected
- Insecure admission controllers disabled — or not running ValidatingAdmissionWebhook
CIS Kubernetes Benchmark
The CIS Benchmark is the industry-standard hardening reference. Two forms:
- CIS Kubernetes Benchmark — for self-managed clusters. Covers master node, worker node, etcd, control-plane configs
- CIS EKS / AKS / GKE Benchmarks — for managed clusters. Covers the aspects you’re responsible for (worker nodes, cluster configs, IAM integration)
Run kube-bench to test your cluster against the applicable benchmark. Fix the fails. Re-run after patches. Combine with kubescape for CIS plus NSA/CISA Kubernetes Hardening Guide.
Managed cluster specifics
Your responsibility differs by provider. Broadly:
- Provider handles: control plane security, master node patching, API server TLS, etcd encryption (enabled by default in most modern managed services)
- You handle: worker node hardening, workload security (Pod Security, Network Policies, RBAC), IAM integration, image supply chain, runtime detection, observability
EKS specifics: IAM Roles for Service Accounts (IRSA), private cluster endpoints, IMDSv2 required on nodes, encryption for etcd Secrets (opt-in, enable it).
AKS specifics: Microsoft Entra ID integration, Azure Policy for K8s, Pod Identity or Workload Identity, private clusters via Azure Private Link.
GKE specifics: Workload Identity (the gold standard across managed services), Shielded Nodes, Binary Authorization for image signing enforcement, Confidential Nodes for AMD SEV-SNP protection.
Audit workflow — first 7 days of owning a cluster
If you inherit a cluster, or want to baseline your own:
- kube-bench — get the CIS Benchmark failures. Patch them
- kubescape scan — adds NSA/CISA hardening guide findings
- Trivy scan on every running image —
trivy image --severity CRITICAL,HIGHagainst image inventory - Inventory ClusterRoleBindings —
kubectl get clusterrolebindings -o yaml | grep -A 3 subjects. Review each - Inventory privileged pods —
kubectl get pods --all-namespaces -o jsonpath='{range .items[?(@.spec.securityContext.privileged==true)]}{.metadata.namespace}/{.metadata.name}{"\\n"}{end}' - Inventory pods with hostPath mounts — similar jsonpath query
- Check NetworkPolicies — count namespaces with zero policies; those are flat
- Enable audit logging if not already
- Deploy Falco (or equivalent runtime detection)
- Image signing — enable Cosign verification via admission policy
This gives you a baseline in a week. Remediation timeline is typically 4-12 weeks depending on cluster maturity.
Quick reference summary
- Control plane (api-server, etcd, scheduler, controller-manager) = Tier-0 assets. Managed clusters outsource this
- Worker plane (kubelet, container runtime, CNI, CSI) is where workloads run
- Pod-to-cluster escalation: SA token → metadata service → privileged escape → RBAC abuse → secret dump → cluster admin
- Pod Security Standards (Baseline / Restricted) via namespace labels; OPA Gatekeeper / Kyverno for granular
- NetworkPolicy everywhere; default-deny per namespace; Cilium for L7-aware
- RBAC: per-workload SA; namespaced Role not ClusterRole; scoped verbs and resources
- Secrets: etcd encryption + external secret store (Vault, cloud SM); never plaintext in git
- Supply chain: Trivy scans, Cosign signing, pinned digests, curated registries, SBOM
- Runtime: Falco / Tetragon / cloud-provider runtime protection
- Misconfigs to audit: privileged, hostPath, hostNet/PID, allowPrivilegeEscalation, runAsRoot, mounted SA tokens, default namespace, exposed kubelet/api-server
- Hardening: CIS Benchmark + kube-bench + kubescape
Take the quiz to complete the Cloud Security Practitioner path. You now have the mental models, the AWS IAM depth, the S3 storage specifics, and the Kubernetes attack-surface coverage to audit, attack, and defend production cloud environments.
Module Quiz · 20 questions
Pass with 80%+ to mark this module complete. Unlimited retries. Each question shows an explanation.
Custom team training + practitioner advisory
Beyond the free academy — we run private workshops, vCISO advisory, and red-team exercises tailored to your stack. For Indian SMBs scaling past their first hire.