Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 106/ 160
06. Security, RBAC & Governance

Pod Security Standards (Privileged, Baseline, Restricted) & Pod Security Admission (PSA)

Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission.

IntermediatePSS · PSA · Restricted3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Pod Security profiles are building codes: Restricted is the strict default, Baseline catches obvious hazards, and Privileged leaves the door open. The simple Kubernetes rule is: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Think of it like…

Pod Security profiles are building codes: Restricted is the strict default, Baseline catches obvious hazards, and Privileged leaves the door open.

Where you’ve seen it

During an access review, the security engineer runs kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite. Expected evidence: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels. If the run instead shows this symptom, stop and restore the last known state: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.

Words you’ll hear

PSS
For this lesson, PSS is the controlling idea: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
PSA
PSA is the checkpoint; run kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite and inspect the owner chain. Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.
Restricted
Restricted is the outcome to preserve; the cost is explicit: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.
Verification evidence
The evidence command is kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite. It connects the declaration to this behavior: Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission.

Visual diagram

Loading interactive diagram

Theory & deep dive

How PSS reaches the intended state

Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission. Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

The concrete checkpoint is kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite; compare the PSS owner, PSA state, and Restricted outcome instead of treating YAML acceptance as proof.

Verify PSA, not only object creation

Run kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite after the change and correlate the result with Events and the owning object. Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Key takeaway: PSS is implemented only when this invariant remains observable: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

PSA: failure boundary and production cost

Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected. The prerequisite contract is concrete: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility. A safe design limits blast radius, records the last good configuration, and uses kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite as a deterministic rollback checkpoint.

Recover from PSA drift

Capture the current state with kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.

Key takeaway: Accept the trade-off consciously: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

How it works, step by step

Step 1 of 4
Identity owner

1. Model the trust boundary

Name the identity, action, resource, and trust boundary before choosing a control: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

PSS contract → owned state
Key numbers at this step
Goal
Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission.
Owner
PSS

When to use it & trade-offs

What it is

Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission. Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Why it matters: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected. The invariant at risk is specific: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels. The quickest fact check before changing the design is kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite.

When to reach for it

  • Use PSS to enforce this invariant: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
  • Use PSA evidence from kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite in reviews and incident timelines. Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission.
  • Choose the hosted security service route only when this cost is justified by governance or scale: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

When to avoid or be careful

  • Avoid assuming PSS is complete after YAML submission; the required behavior is concrete: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite first: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.
  • Avoid adopting a heavier platform wrapper before measuring its cost: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

Native, manual, and managed paths for PSS

Admission and least privilege
Best for: Enforce Privileged/Baseline/Restricted profiles with Pod Security Admission. A concrete incident check is kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite.

Strengths: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Watch out: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility. Recovery must also recognize this signal: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.

Runtime-only detection
Best for: Quickly testing the PSA assumption with kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite; the expected invariant is: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Strengths: kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike PSS, it does not make this symptom self-documenting: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.

Hosted security service
Best for: Teams that need Restricted integrated with guardrails; the evidence path is kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.

Watch out: The added platform ownership buys value at this cost: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
  • Trace PSS to Restricted through PSA; the invariant is: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
  • Recognize the symptom: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.
  • Justify the cost: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.
  • Verify with kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite instead of only inspecting YAML.

Benchmarks & rules of thumb

3 -
profiles: Privileged, Baseline, and Restricted
3 -
namespace policy modes: enforce, audit, and warn
1 -
profile version should be pinned deliberately

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the PSS owner contract: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels.
  • Ignoring this telltale condition leads to unrelated changes: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected.
  • Repeating kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite without an owner for remediation wastes retry cost. PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels?
  • Which owner object, logs, and Events would you inspect for this symptom-Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected-?
  • At what threshold would this cost become unacceptable: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility?
Interview tip: Interview sequence: state the invariant, run kubectl get ns --show-labels; kubectl label ns prod pod-security.kubernetes.io/enforce=restricted --overwrite, name the failure, then justify the cost. Invariant: Pod Security Standards define Privileged, Baseline, and Restricted profiles, and Pod Security Admission enforces, audits, or warns through namespace labels. Failure: Setting only enforce can miss future violations that warn in CI, and an older Pod created before a new namespace policy may remain even after new workloads are rejected. Cost: PSA provides a built-in admission baseline, but exceptions for privileged agents require explicit namespaces, policy versions, and migration visibility.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Pod Security Standards (Privileged, Baseline, Restricted) & Pod Security Admission (PSA) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Auditing & Debugging RBAC Permissions (kubectl auth can-i)
Next topic
SecurityContext: runAsNonRoot, readOnlyRootFilesystem, Dropping Capabilities