SecurityVol. 10 · Part X
0 / 0

Shelves / Security

SE·111

Container, Kubernetes and Cloud Security

Securing the platform your code runs on: the 4C model, minimal and hardened images, image scanning and vulnerability management, signing and admission control, non-root and rootless containers, seccomp, capabilities and read-only filesystems, Pod Security Standards, Kubernetes RBAC, secrets management, network policies, service identities and mTLS, workload identity, runtime detection with Falco and Tetragon, and cloud security posture (CSPM, guardrails, logging).

27 topics · ~18 min read · 30-question quiz
Updated Suggest a correction

Start here: shrinking what a compromised container can do

Assume that one day an attacker gets code running inside one of your containers, through a library bug or a stolen credential. Platform security is about what happens next: can they become root, write to disk, talk to every other service, read the cluster's secrets? Each setting below takes one of those options away.

Containers start with more power than they need

The same Alpine image, run with Docker's defaults and then hardened:

Text
default:   uid=0(root)   CapEff: 00000000a80425fb   write / ok
hardened:  uid=1000      CapEff: 0000000000000000   touch: /x: Read-only file system
           (--user 1000:1000 --cap-drop ALL --read-only --security-opt no-new-privileges)

Decoded, the default a80425fb is 14 capabilities: chown, dac_override, fowner, fsetid, kill, setgid, setuid, setpcap, net_bind_service, net_raw, sys_chroot, mknod, audit_write, setfcap. Most services need none of them. The hardened container is not root, has no capabilities, can't write its own filesystem (so an attacker can't drop tools into it) and can't gain privileges through setuid binaries.

Kubernetes can refuse unsafe pods

The namespace sec is labelled pod-security.kubernetes.io/enforce=restricted. A pod asking for privileged: true and hostNetwork: true was refused at the API server, with every reason listed:

Text
pods "bad" is forbidden: violates PodSecurity "restricted:latest":
  host namespaces (hostNetwork=true),
  privileged (container "c" must not set securityContext.privileged=true),
  allowPrivilegeEscalation != false, unrestricted capabilities (must set drop=["ALL"]),
  runAsNonRoot != true, seccompProfile (must be "RuntimeDefault" or "Localhost")

The hardened pods (non-root, drop: [ALL], read-only root filesystem, RuntimeDefault seccomp, no privilege escalation) were admitted and ran normally. Pod Security Admission turns "please configure pods safely" into a rule the cluster enforces.

By default every pod can reach every pod

Text
shell → web:8080 with no policy:            ok
after a default-deny ingress policy:        Connection refused
after allowing app=shell → web:8080:        ok
from a pod labelled app=other:              Connection refused

A Kubernetes cluster's network is flat until you add NetworkPolicies. Deny by default, then allow exactly the flows the architecture needs; a compromised pod can then reach only what it was already supposed to talk to.

Give each workload only the API permissions it needs

A service account reader bound to a Role allowing get and list on pods in sec:

Text
get pods -n sec:          yes        delete pods -n sec:       no
list pods -n sec:         yes        get secrets -n sec:       no
get pods -n kube-system:  no         create pods/exec -n sec:  no

Kubernetes RBAC is deny-by-default; kubectl auth can-i lets you check exactly what an identity can do. Pods that don't call the API shouldn't even carry a token: the web pod set automountServiceAccountToken: false and has no token volume, while the shell pod still has kube-api-access-… mounted.

How deep to go in container, Kubernetes and cloud security

Volume 17 defines six mastery levels. For this chapter they look like this; the chapter aims at L3 everywhere, and its lab at L4.

Level What you can do
L1 Explain why containers aren't a security boundary by default and name the main hardening settings
L2 Ship hardened images and pod specs: non-root, drop ALL, read-only, seccomp, no token, resource limits
L3 Explain Pod Security Standards, RBAC, NetworkPolicies, secrets handling and workload identity and how they combine
L4 Audit a cluster or cloud account for over-privilege, flat networks and exposed secrets, and verify fixes
L5 Design a platform's guardrails: admission policies, signed images, runtime detection, cloud posture management
L6 Set platform security standards and governance across many clusters, accounts and teams

The 4C model

Cloud-native security is layered: Cloud → Cluster → Container → Code. Each layer depends on the one beneath it: perfect application code can't compensate for a public Kubernetes API with anonymous access, and a hardened cluster can't save an app with SQL injection.

cloud: IAM · VPC · KMS · audit logs · posture management cluster: API access · RBAC · admission · network policy · nodes container: minimal signed image · non-root · seccomp · read-only fs codeinput handling · authZ · dependencies · secrets use
The 4C model of cloud-native security. Each layer builds on the security of the one outside it: the cloud account (IAM, network, logging), the cluster (API access, RBAC, admission, network policies), the container (image, runtime privileges), and the code (application vulnerabilities, dependencies, secrets handling).

Container fundamentals (namespaces, cgroups, images, Dockerfiles) are in Vol. 6 ch. 80–81 and Kubernetes in ch. 83; cloud IAM in Vol. 7 ch. 89. This chapter focuses on hardening.

Images

Minimal images

Every package in an image is potential attack surface and a source of vulnerability-scanner noise. Shrink it:

  • Multi-stage builds: compile in a full SDK image, copy only the binary/artifacts into the runtime image.
  • Minimal bases: distroless (Google), Chainguard/Wolfi images, Docker Hardened Images (free since December 2025), Ubuntu Chisel, Alpine (musl), scratch for static binaries (Go, Rust with musl).
  • No shells, package managers, compilers or debugging tools in production images; use ephemeral debug containers (kubectl debug) when needed.
  • Pin base images by digest (FROM cgr.dev/chainguard/static@sha256:…) and update them automatically (Renovate/Dependabot), so builds are reproducible and updates deliberate.
Dockerfile
# Go service: build stage + distroless static runtime, non-root
FROM golang:1.25 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/api ./cmd/api

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/api /api
USER nonroot:nonroot
ENTRYPOINT ["/api"]

Image scanning and vulnerability management

Scanners (Trivy, Grype, Docker Scout, Snyk Container, cloud registry scanning: Amazon Inspector, Artifact Analysis, Defender for Containers) match the packages in an image (OS packages and language dependencies) against vulnerability databases (NVD, GitHub Advisory Database, OSV, distro security trackers).

Scanning in practice:

  • Scan in CI (fail on fixable critical/high above policy), in the registry (continuously, because new CVEs are published against old images), and at admission or runtime (what's actually deployed).
  • Prioritise by real risk, not raw CVSS: is the vulnerable package reachable/loaded at runtime? Is it exploited in the wild (CISA KEV catalogue)? What's the exploit likelihood (EPSS)? Is the workload internet-facing or privileged?
  • Use VEX (Vulnerability Exploitability eXchange) statements to record "not affected" decisions with justification, so tools suppress them consistently.
  • Set SLAs by severity (e.g. KEV/critical internet-facing: days; high: weeks), track exceptions with expiry dates, and measure mean time to remediate.
  • The most effective fix is usually rebuilding on a fresh base image frequently: automate it.

Signing and admission

Sign images in CI and verify signatures before they run (chapter 112 for Sigstore/cosign and SLSA provenance):

  • Kubernetes admission controllers (Kyverno, OPA Gatekeeper, Sigstore policy-controller, Ratify, or cloud features like GKE Binary Authorization) reject pods whose images aren't signed by your CI identity, don't come from approved registries, or lack provenance attestations.
  • Reference images by digest in deployments (tags are mutable).

Runtime hardening for containers

Containers share the host kernel; a compromised container with excessive privileges can often escape to the node. Reduce what a compromised process can do:

Control Setting
Run as non-root runAsNonRoot: true, runAsUser: 10001; USER in Dockerfile
No privilege escalation allowPrivilegeEscalation: false (sets no_new_privs: setuid binaries can't gain privileges)
Drop capabilities capabilities: { drop: ["ALL"] }, add back only specific ones (e.g. NET_BIND_SERVICE)
Never privileged No privileged: true, hostPID, hostNetwork, hostIPC, hostPath mounts (especially the container runtime socket)
Seccomp seccompProfile: { type: RuntimeDefault } blocks dangerous syscalls
AppArmor / SELinux Mandatory access control profiles (RuntimeDefault)
Read-only root filesystem readOnlyRootFilesystem: true + emptyDir for /tmp
Resource limits CPU/memory limits; prevent noisy-neighbour and DoS
User namespaces hostUsers: false maps container root to an unprivileged host UID (Kubernetes user namespaces, beta and on by default since 1.33)
Sandboxed runtimes gVisor, Kata Containers, Firecracker microVMs for untrusted multi-tenant workloads
YAML
apiVersion: apps/v1
kind: Deployment
metadata: { name: api, namespace: payments }
spec:
  template:
    spec:
      serviceAccountName: api
      automountServiceAccountToken: false          # mount only if the app calls the K8s API
      hostUsers: false                             # user namespaces
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001
        fsGroup: 10001
        seccompProfile: { type: RuntimeDefault }
      containers:
        - name: api
          image: registry.example.com/payments/api@sha256:3b1f…   # by digest
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities: { drop: ["ALL"] }
          resources:
            requests: { cpu: 250m, memory: 256Mi }
            limits: { memory: 256Mi }
          volumeMounts: [{ name: tmp, mountPath: /tmp }]
      volumes: [{ name: tmp, emptyDir: {} }]

Rootless container engines (Podman rootless, Docker rootless mode, rootless BuildKit, Kaniko-style builds) also run the runtime itself without root on the host, so an escape lands in an unprivileged user account. Building images in CI without a privileged Docker-in-Docker daemon removes a common cluster-compromise path.

Pod Security Standards

Kubernetes' built-in Pod Security Admission enforces three Pod Security Standards per namespace:

Level Meaning
privileged Unrestricted (system components only)
baseline Blocks known privilege escalations: privileged, host namespaces, hostPath, added dangerous capabilities
restricted Hardened: non-root, drop ALL capabilities, seccomp RuntimeDefault, no privilege escalation
YAML
apiVersion: v1
kind: Namespace
metadata:
  name: payments
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/warn: restricted

For rules beyond these (approved registries, required labels, signature verification, no latest tags), use Kyverno or Gatekeeper policies, or built-in ValidatingAdmissionPolicy (CEL expressions, GA since 1.30).

Kubernetes control plane and RBAC

Protecting the API server

The Kubernetes API is the cluster's control plane: whoever can create pods with arbitrary specs in a namespace can usually read its secrets and use its service accounts; whoever can create privileged pods can own nodes.

  • Private API endpoint or IP allow-lists; no anonymous auth; authenticate humans via OIDC/SSO (cloud IAM integration), not shared admin kubeconfigs or static tokens.
  • Audit logging enabled and shipped to the SIEM.
  • etcd encryption at rest for Secrets (KMS provider), etcd access restricted to the API server.
  • Keep the cluster up to date (supported minor versions; managed control planes help).
  • Node hardening: minimal OS (Bottlerocket, Talos, Container-Optimized OS, Flatcar), restricted kubelet API, no SSH where possible, block pods from the cloud metadata endpoint (or require IMDSv2 with hop limit 1) so they can't steal the node's role.

RBAC

Kubernetes RBAC grants verbs on resources to subjects:

  • Role/ClusterRole: a set of rules (apiGroups, resources, verbs), namespaced or cluster-wide.
  • RoleBinding/ClusterRoleBinding: grants a role to users, groups or service accounts.
YAML
# Least privilege: the "reporter" service account may read ConfigMaps in its namespace only
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: { name: configmap-reader, namespace: payments }
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: { name: reporter-reads-config, namespace: payments }
subjects:
  - kind: ServiceAccount
    name: reporter
    namespace: payments
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: configmap-reader

Dangerous permissions to audit for (they're effectively cluster-admin or secret access):

  • cluster-admin bindings to people or CI; wildcards (*) in verbs or resources.
  • create pods (or deployments, jobs…) in privileged namespaces; pods/exec, pods/attach.
  • get/list/watch secrets (list returns secret values).
  • escalate, bind, impersonate verbs; nodes/proxy; write access to webhooks (mutatingwebhookconfigurations).
  • Service accounts in CI/CD tools (Argo CD, Flux, Jenkins agents) that hold broad rights: protect them as crown jewels.

Tools: kubectl auth can-i --list --as=system:serviceaccount:payments:reporter, rbac-tool, KubiScan, Kubescape, cloud posture tools.

Secrets management

Kubernetes Secrets are base64-encoded objects in etcd: not encrypted unless you configure encryption at rest, and readable by anyone with get secrets in the namespace or the ability to create pods that mount them. Practices:

  • Enable etcd encryption with a KMS provider; restrict RBAC on secrets tightly.
  • Store source-of-truth secrets in an external secrets manager (AWS Secrets Manager, Azure Key Vault, Google Secret Manager, HashiCorp Vault/OpenBao) and sync or mount them with External Secrets Operator or the Secrets Store CSI driver; for GitOps, commit only encrypted secrets (SOPS with KMS/age, Sealed Secrets).
  • Prefer dynamic, short-lived credentials (Vault database secrets engine, IAM database authentication) and workload identity (no secret at all) over static secrets.
  • Mount secrets as files (with rotation via projected volumes) rather than environment variables when possible: env vars leak via /proc, crash dumps, child processes and debug endpoints.
  • Never bake secrets into images or commit them to Git; run secret scanning in CI and pre-commit; rotate immediately if leaked (removing the commit isn't enough: assume it was copied).

Network security

Network policies

By default every pod can reach every other pod in a Kubernetes cluster. NetworkPolicies (enforced by the CNI: Cilium, Calico, Antrea; cloud-native implementations) restrict traffic by pod labels, namespaces and IP blocks. Start with default deny per namespace, then allow what's needed:

YAML
# Default deny all ingress and egress in the namespace
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: default-deny, namespace: payments }
spec:
  podSelector: {}
  policyTypes: ["Ingress", "Egress"]
---
# Allow the API to receive from the gateway and talk to Postgres and DNS
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: api, namespace: payments }
spec:
  podSelector: { matchLabels: { app: api } }
  policyTypes: ["Ingress", "Egress"]
  ingress:
    - from:
        - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: gateway } }
      ports: [{ port: 8080, protocol: TCP }]
  egress:
    - to: [{ podSelector: { matchLabels: { app: postgres } } }]
      ports: [{ port: 5432, protocol: TCP }]
    - to:
        - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: kube-system } }
          podSelector: { matchLabels: { k8s-app: kube-dns } }
      ports: [{ port: 53, protocol: UDP }, { port: 53, protocol: TCP }]

Egress restrictions limit data exfiltration and SSRF reach. CNIs like Cilium add L7 (HTTP method/path, DNS name) policies; the newer AdminNetworkPolicy API lets cluster admins set guardrails namespaces can't override.

Service identity and mTLS

NetworkPolicies are based on IPs and labels; they say what can connect, not who the caller is. A service mesh (Istio, including ambient mode; Linkerd; Cilium service mesh) gives every workload a cryptographic identity (SPIFFE IDs derived from service accounts) and encrypts service-to-service traffic with mTLS automatically, with authorisation policies such as "only payments/api may call ledger/api POST /entries". This is zero trust applied inside the cluster (chapter 106).

Workload identity in the cloud

Pods should get cloud permissions through workload identity (chapter 109; Vol. 7 ch. 89): EKS Pod Identity or IRSA, GKE Workload Identity Federation, AKS Workload Identity. Each Kubernetes service account maps to a distinct cloud role with least privilege. Avoid node-level roles shared by every pod on the node, and avoid static cloud keys in Secrets.

Runtime security

Prevention will sometimes fail; runtime detection watches what workloads actually do, typically using eBPF in the kernel:

  • Falco (CNCF graduated): rules over syscalls and Kubernetes audit events, e.g. "shell spawned in a container", "write below /etc", "outbound connection to unexpected port", "read of sensitive file", "container drift (new executable not in image)".
  • Tetragon (Cilium, CNCF): eBPF-based observability and enforcement (can kill a process or block a syscall in-kernel when a policy matches).
  • KubeArmor, commercial CNAPP/CWPP agents (Sysdig, Aqua, Prisma Cloud, Wiz Defend, Microsoft Defender for Containers, GuardDuty EKS Runtime Monitoring).
YAML
# Falco rule (simplified): alert when an interactive shell starts in a container
- rule: Terminal shell in container
  desc: A shell was spawned with an attached terminal inside a container
  condition: >
    spawned_process and container and proc.name in (bash, sh, zsh, ash)
    and proc.tty != 0
  output: >
    Shell in container (user=%user.name pod=%k8s.pod.name ns=%k8s.ns.name
    image=%container.image.repository cmd=%proc.cmdline)
  priority: WARNING
  tags: [container, shell, mitre_execution]

Runtime signals are most valuable with good baselines: minimal images (any new binary is suspicious), read-only filesystems (writes are anomalies), and egress policies (unexpected connections stand out). Route alerts into incident response (Vol. 9 ch. 103) with clear runbooks.

Cloud security posture

Most cloud breaches stem from misconfiguration and identity, not exotic exploits: public storage buckets, over-privileged roles, exposed management ports, leaked access keys, disabled logging.

  • Account structure and guardrails: separate accounts/projects/subscriptions per environment and workload; organisation-level policies (AWS SCPs and RCPs, Azure Policy, GCP Organization Policies) that prevent dangerous configurations (no public buckets, regions allow-list, no disabling of logging).
  • Identity: SSO for humans with MFA, no long-lived user access keys, least-privilege roles, just-in-time elevation for admin access, break-glass accounts monitored.
  • Logging: CloudTrail/Activity Logs/Cloud Audit Logs on everywhere, in a separate, locked-down log archive account; threat detection (GuardDuty, Defender for Cloud, Security Command Center).
  • CSPM / CNAPP: continuous posture scanning against benchmarks (CIS), attack-path analysis (which internet-exposed workload has a role that can read the customer database?).
  • IaC scanning before deployment (Checkov, tfsec/Trivy config, KICS, Conftest with OPA) so misconfigurations are caught in pull requests (Vol. 8 ch. 94).
  • Data protection: encryption with KMS keys, private endpoints for managed services, data classification, backups protected from deletion (immutable, separate account).

Lab: hardening a container and a cluster, measured

Docker 29 and single-node k3s 1.37 on the lab machine; k3s ships kube-router's NetworkPolicy controller, so policies are enforced without an extra CNI. The namespace sec was created with pod-security.kubernetes.io/enforce=restricted.

Experiment 1: what Docker's defaults grant

Text
docker run --rm alpine:3.22 …
  uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),…
  CapEff: 00000000a80425fb    write / ok
docker run --rm --user 1000:1000 --cap-drop ALL --read-only --security-opt no-new-privileges alpine:3.22 …
  uid=1000 gid=1000 groups=1000
  CapEff: 0000000000000000    touch: /x: Read-only file system

capsh --decode=00000000a80425fb lists the 14 default capabilities. Note net_raw (craft packets, ARP-spoof neighbours on some networks) and dac_override (ignore file permissions): reasons enough to drop everything and add back only what a service proves it needs. Root inside a container is still a real uid 0 on the host kernel unless you use user namespaces (rootless Docker or Podman, or Kubernetes hostUsers: false), so a kernel bug or a mounted host path turns it into host root.

Experiment 2: Pod Security Admission

The rejection listed six violations from one pod spec (host network, privileged, privilege escalation, capabilities, non-root, seccomp). The admitted spec:

YAML
spec:
  automountServiceAccountToken: false
  securityContext: {runAsNonRoot: true, runAsUser: 65532, seccompProfile: {type: RuntimeDefault}}
  containers:
  - name: tiffin
    image: tiffin:2.2
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities: {drop: ["ALL"]}
    resources: {limits: {cpu: 200m, memory: 64Mi}}

Inside the hardened shell pod:

Text
uid=1000 gid=0(root) groups=0(root)
CapEff: 0000000000000000
touch: /x: Read-only file system
touch: /tmp/x: Read-only file system

Two lessons from that output. First, gid=0: the pod set runAsUser but not runAsGroup, so the process kept the root group, which can matter for group-readable files; set runAsGroup (and fsGroup for volumes) too. Second, /tmp is read-only as well, which breaks many programs; mount an emptyDir at /tmp rather than giving up on read-only roots. Roll the policy out with warn and audit labels first, then enforce, so existing workloads show their violations before they're blocked.

Experiment 3: NetworkPolicies

Text
shell → web:8080, no policy:              ok
default-deny ingress applied:             wget: can't connect … Connection refused
allow podSelector app=shell → web:8080:   ok
pod app=other → web:8080:                 Connection refused
YAML
spec: {podSelector: {}, policyTypes: [Ingress]}            # default-deny for the namespace
---
spec:
  podSelector: {matchLabels: {app: web}}
  ingress: [{from: [{podSelector: {matchLabels: {app: shell}}}], ports: [{port: 8080, protocol: TCP}]}]

Policies are additive allow-lists: once any policy selects a pod for ingress, only listed flows reach it. Remember egress too: a default-deny egress policy (with DNS to kube-dns allowed) stops a compromised pod calling out to an attacker's server or to the cloud metadata endpoint. NetworkPolicies are enforced by the CNI plugin; on a cluster whose CNI ignores them, they silently do nothing, which is exactly why you test them like this.

Experiment 4: RBAC, checked rather than assumed

Text
reader can get pods -n sec:           yes
reader can list pods -n sec:          yes
reader can delete pods -n sec:        no
reader can get secrets -n sec:        no
reader can get pods -n kube-system:   no
reader can create pods/exec -n sec:   no
token volume: web: (none)   shell: kube-api-access-d9qh9

The dangerous permissions to look for in any audit: secrets get/list (all credentials in a namespace), pods/exec (a shell in any pod), create pods (run a pod that mounts any secret or service account), escalate, bind and impersonate, and wildcards (*). kubectl auth can-i --list --as=… prints everything an identity holds.

Try it yourself

  1. Add runAsGroup: 1000 and an emptyDir at /tmp to the shell pod; rerun id and touch /tmp/x.
  2. Add a default-deny egress policy and find out what breaks first (hint: DNS). Then allow UDP and TCP 53 to kube-dns only.
  3. Grant reader permission to create pods and reason about why that is close to granting get secrets.
  4. Label a namespace with pod-security.kubernetes.io/warn=restricted only, apply the bad pod, and compare the output with enforce.

Revision sheet: container, Kubernetes and cloud security

Key ideas

  • 4C model: cloud, cluster, container, code; each layer relies on the one below.
  • Images: minimal or distroless, pinned by digest, scanned, rebuilt often, signed, verified at admission.
  • Runtime hardening: non-root (with runAsGroup), drop ALL capabilities, read-only root, no privilege escalation, seccomp RuntimeDefault, resource limits; user namespaces where available.
  • Pod Security Standards: privileged, baseline, restricted; enforced per namespace by Pod Security Admission; policy engines (Kyverno, Gatekeeper, ValidatingAdmissionPolicy) for custom rules.
  • RBAC: least-privilege Roles, no wildcards, watch secrets/exec/create-pods/escalate/bind/impersonate; disable token automount where unused.
  • Network: default-deny ingress and egress, explicit allows, mTLS via a mesh for identity between services.
  • Secrets: external secret stores or encrypted-at-rest etcd; never in images or env dumps; short-lived workload identity instead of static cloud keys.
  • Runtime detection: Falco, Tetragon (eBPF) for unexpected shells, network calls, file writes.
  • Cloud posture: guardrails (SCPs, org policies), CSPM, central audit logs, block public storage by default.

Numbers to remember

  • Docker default: 14 capabilities (CapEff a80425fb); hardened: 0.
  • Lab: one privileged pod spec produced six Pod Security violations.
  • Lab: default-deny + one allow left exactly one client able to reach web.

Pitfalls

  • Treating containers as a hard security boundary; root in a container is root on the kernel.
  • runAsUser without runAsGroup; privileged: true "for debugging" left in.
  • NetworkPolicies on a CNI that doesn't enforce them.
  • Wildcard RBAC and cluster-admin for CI.
  • Static cloud keys in Kubernetes Secrets instead of workload identity.
  • Mounting the Docker socket or host paths into pods.

Glossary

  • Capability: a slice of root's power.
  • seccomp: system-call filter for a process.
  • Admission controller: API-server hook that can reject or modify objects on create.
  • CSPM: cloud security posture management.
  • Workload identity: short-lived cloud credentials bound to a pod's service account.