New recipes every week

Turn Complexity Into
Cloud Recipes

Learn Kubernetes, AI, DevOps and DevSecOps the CloudChef way. Practical guides, real-world examples, no fluff.

Free forever No paywall Practical guides Real-world examples
50+Guides
WeeklyNew posts
K8s + AITop topics
FreeAlways
DevSecOps Kubernetes Tuesday, July 14, 2026 ⏱ Calculating...

Pod Security Standards: The PSP Replacement You Still Haven't Set Up

CC
CloudChef
thecloudchef.io
Kubernetes Pod Security Standards explained — CloudChef

PodSecurityPolicies were removed in Kubernetes 1.25. That was quite a while ago. And yet, right now, there are production clusters running with no workload security policy enforcement whatsoever — because teams removed PSPs when they had to, said "we'll replace them properly soon," and haven't yet.

This is that article that helps you finally do it properly.


😀 Why PSPs Got Removed (And Why That Was Actually Fine)

PodSecurityPolicies were genuinely confusing. The admission logic was poorly documented, they interacted with RBAC in non-obvious ways, and getting them wrong often meant pods stopped scheduling with cryptic error messages. They did important things. They were also a pain to work with.

Pod Security Standards (PSS) — enforced through the Pod Security Admission controller — replace them with something much cleaner. Three profiles. Clear semantics. Namespace-level enforcement. No RBAC entanglement.


🧠 The Three Profiles — Simple Version First

Imagine you're renting out units in a building. You have three lease types:

  • Privileged — The tenant can do literally anything. Knock down walls, run experiments with the gas lines. No restrictions. This is for system-level infrastructure workloads that genuinely need it.
  • Baseline — Normal tenant rules. No illegal modifications. But they can hang pictures and rearrange furniture. Prevents known privilege escalation while allowing most normal workloads.
  • Restricted — Full building code compliance. Read-only surfaces, runs as non-root, no privilege escalation, locked down capabilities. The tightest possible standard for sensitive workloads.
flowchart LR Privileged["πŸ”΄ Privileged\n(System workloads)"] --> Baseline["🟑 Baseline\n(Most apps)"] --> Restricted["🟒 Restricted\n(Sensitive apps)"]

⚙️ How to Actually Enable It

Pod Security Admission is built into Kubernetes since 1.23 — no extra install needed. You enable it per namespace using labels.

# Enforce restricted profile in your production namespace
kubectl label namespace production \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/enforce-version=latest \
  pod-security.kubernetes.io/warn=restricted \
  pod-security.kubernetes.io/warn-version=latest \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/audit-version=latest

πŸ‘‰ The three modes — enforce, warn, audit — are independent. You can audit everything, warn on restricted violations, but only enforce baseline. This is how you roll it out gradually without breaking production at 9am on a Monday.

The rollout strategy that actually works:

# Phase 1: audit only — see what would fail, don't break anything
kubectl label namespace production \
  pod-security.kubernetes.io/audit=restricted

# Check the audit logs for violations
kubectl get events -n production --field-selector reason=FailedCreate

# Phase 2: add warnings — developers see warnings but pods still schedule
kubectl label namespace production \
  pod-security.kubernetes.io/warn=restricted

# Phase 3: once violations are fixed — enforce
kubectl label namespace production \
  pod-security.kubernetes.io/enforce=restricted

πŸ›‘️ What "Restricted" Actually Requires

securityContext:
  runAsNonRoot: true
  runAsUser: 1000
  seccompProfile:
    type: RuntimeDefault     # or Localhost with a custom profile
  allowPrivilegeEscalation: false
  capabilities:
    drop:
      - ALL

That's the spec your pods need to pass the restricted profile. If your workload sets runAsRoot: true or doesn't drop capabilities, it gets rejected at admission before it ever schedules.


⚠️ Common Mistakes

  • Applying restricted to kube-system directly — System components often need elevated permissions. Label kube-system as privileged and enforce restricted everywhere else.
  • Skipping the audit phase — Going straight to enforce without auditing first is how you find out at the worst possible moment that your log shipper DaemonSet runs as root.
  • Thinking PSS replaces all of PSP's functionality — PSS doesn't cover network policies, volume restrictions, or fine-grained AppArmor profiles. For those, you still need a policy engine like Kyverno or OPA.

πŸ”₯ CloudChef Pro Tip

Use PSS as the floor, not the ceiling.

πŸ‘‰ PSS enforces the profile baseline. Kyverno or OPA handles everything else — specific image registries, required labels, resource limit enforcement. They work together, not as alternatives.

πŸ”— Continue Your CloudChef Journey


πŸ“š References


πŸš€ Final Thoughts

PSP removal was a blessing in disguise. Pod Security Standards are cleaner, easier to reason about, and built into Kubernetes with zero extra setup. The only thing stopping you from enabling them right now is the same thing that stopped PSP adoption: taking the time to actually do it.

πŸ‘‰ Start with audit mode today. See what breaks. Fix it. Then enforce. It's not complicated — it just takes the decision to actually start.


πŸ”₯ Trending CloudChef Recipes

⭐ Popular CloudChef Recipes

No comments:

Post a Comment

πŸ’‘ Found this useful?

Share it with your Team or DevOps Friends πŸ‘‡