Kubernetes and container security hardening – Secured Me

Kubernetes and container security hardening

A practical hardening guide for containers and Kubernetes: image supply chain, runtime, RBAC, network policy, secrets, and detection.

Kubernetes has become the default platform for running production workloads, but its defaults are aimed at developer ergonomics rather than security. A freshly installed cluster will happily run privileged containers, mount the host filesystem, expose the dashboard, and grant broad service account permissions. Hardening Kubernetes is less about exotic tooling and more about systematically closing those defaults at every layer: image, pod, cluster, network, and runtime. This guide walks through the controls that disproportionately reduce blast radius.

Securing the image supply chain

Everything in Kubernetes ultimately runs container images, so this is where hardening starts.

A maintained internal registry, with scanning and signing baked in, is usually a better long-term investment than ad-hoc image hygiene per team.

Pod-level controls: PSA, securityContext, and friends

The Pod Security Admission (PSA) controller is the modern replacement for the deprecated PodSecurityPolicy. It enforces one of three profiles per namespace: privileged, baseline, or restricted. Production namespaces should run restricted as the enforced level, with baseline at most for legacy workloads. Every pod should set a securityContext that blocks the obvious foot-guns:

These few settings prevent the majority of container-escape and privilege-escalation techniques used in real-world Kubernetes attacks.

RBAC, service accounts, and secrets

RBAC is where most clusters quietly hand out too much power.

Network policy and isolation

A default Kubernetes cluster is a flat L3 network: every pod can reach every other pod on any port. That is rarely what you want.

Runtime detection and incident readiness

Even a hardened cluster will eventually face suspicious activity, and you want to see it.

Container and Kubernetes security is not a single tool you buy; it is a layered policy that you apply consistently across image build, deployment, runtime, and observability. The good news is that almost every control above can be enforced as code — admission policies, NetworkPolicies, RBAC manifests — so once it is set up, it scales with the platform rather than fighting it.