DevSecOps

Kubernetes security: the controls that matter most

A prioritised guide to securing Kubernetes (RBAC, pod security, network policy, secrets and supply chain) ordered by risk reduced rather than by chapter number.

DevOpsArk SecuritySecurity engineering, DevOpsArkPublished 9 April 2026 · Updated 13 August 202610 min read
TL;DR

Kubernetes defaults are permissive: pods can usually talk to every other pod, service accounts get mounted whether or not they are used, and RBAC accumulates breadth over time. The controls with the best return are a pod security baseline enforced at admission, default-deny network policy in sensitive namespaces, tight RBAC reviewed against actual usage, and admission control on image provenance.

Short answer

How do you secure a Kubernetes cluster?

Secure a Kubernetes cluster by enforcing a pod security baseline at admission so privileged workloads cannot be created, applying default-deny network policies so pods cannot reach services they do not need, keeping RBAC scoped and reviewed against actual usage, avoiding long-lived Secret objects in favour of runtime-injected credentials, and restricting which images may be deployed.

What the defaults actually give you

It is worth being explicit about the starting position, because several defaults surprise people.

  • All pods can reach all other pods across all namespaces. Namespaces are not a network boundary without network policies.
  • A service account token is mounted into every pod by default, whether the workload uses the API or not.
  • Containers run as whatever user the image specifies, which for many public images is root.
  • Secret objects are base64-encoded, not encrypted, and stored in etcd.
  • Any image from any registry can be deployed unless admission policy restricts it.

Pod security standards, enforced at admission

Pod Security Admission provides three levels (privileged, baseline and restricted) applied per namespace. Restricted is where you want production to end up: non-root, no privilege escalation, dropped capabilities, seccomp enabled.

apiVersion: v1
kind: Namespace
metadata:
  name: payments
  labels:
    # Enforce restricted; also warn and audit so violations are visible
    # in tooling that has not caught up yet.
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/audit: restricted
Start in warn mode. Label namespaces with warn and audit first, collect the violations, fix them, then switch enforce on. Enforcing first produces a wave of exceptions, and exceptions granted under pressure do not get revisited.

Network policy: default deny, then allow

Flat pod networking means a single compromised pod can reach every service in the cluster. Network policy is the control that limits lateral movement, and it is the one most often skipped because it requires knowing what actually talks to what.

# Deny all ingress in the namespace, then add explicit allows.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-ingress
  namespace: payments
spec:
  podSelector: {}
  policyTypes: [Ingress]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-api-from-gateway
  namespace: payments
spec:
  podSelector:
    matchLabels: { app: payments-api }
  policyTypes: [Ingress]
  ingress:
    - from:
        - namespaceSelector:
            matchLabels: { name: edge }
          podSelector:
            matchLabels: { app: gateway }
      ports:
        - protocol: TCP
          port: 8080

The practical route is to derive the allow list from observed traffic rather than from an architecture diagram. Observed dependencies reflect what the system actually does; diagrams reflect what it was supposed to do two refactors ago.

RBAC that stays tight

RBAC accumulates. A binding granted for an incident stays. A role widened to unblock a deployment is never narrowed. Within a year, nobody can answer who can delete a production namespace.

  • Prefer Role over ClusterRole. Most workloads need namespace scope, not cluster scope.
  • Avoid wildcard verbs and resources. A role with * on * is an administrator whatever it is called.
  • Set automountServiceAccountToken: false on workloads that never call the API, which is most of them.
  • Review against usage, not against the list of grants. A permission never exercised in six months is a straightforward revocation.
  • Watch for the escalation paths: create pod plus a privileged service account, or the ability to create bindings, are effectively cluster admin.

Secrets and supply chain at admission

Kubernetes Secrets are base64-encoded objects in etcd. With encryption at rest and tight RBAC they can be acceptable, but they are long-lived, unrotated and produce no read audit. Projecting short-lived credentials at runtime from a dedicated store avoids all three problems.

On the supply chain side, admission control is where policy becomes enforcement: restrict which registries may be pulled from, require image signatures, and require a digest rather than a tag. That last one alone prevents an entire class of substitution.

A prioritised order

  1. Pod security baseline in warn mode; fix violations; then enforce.
  2. Disable service account token automounting where it is not needed.
  3. Default-deny network policy in the most sensitive namespaces, with allows derived from observed traffic.
  4. RBAC review against usage; remove wildcards and unused bindings.
  5. Move secrets out of Secret objects into runtime injection.
  6. Registry restriction and signature verification at admission.
  7. Continuous posture checking so drift from all of the above is reported.

Key takeaways

  • Kubernetes defaults are permissive: flat networking, mounted tokens, unrestricted images.
  • Enforce pod security standards at admission, but start in warn mode.
  • Default-deny network policy is the main control against lateral movement.
  • Derive network allow lists from observed traffic, not from architecture diagrams.
  • Review RBAC against actual usage; unused grants are easy revocations.
  • Admission control on registries, signatures and digests closes the supply chain.

Frequently asked questions

KubernetesSecurityRBACNetwork policy

See this working on your own infrastructure

A 30-minute walkthrough with a platform engineer. Bring the problem this article describes.