Currently viewing the AI version
Switch to human version

Pod Security Admission (PSA) - AI-Optimized Technical Reference

Core Functionality

What PSA Does:

  • Built-in Kubernetes validating admission controller (enabled by default since v1.23)
  • Enforces three predefined security profiles via namespace labels
  • Replaces deprecated Pod Security Policies (PSPs) removed in v1.25
  • Validates pods before creation, rejects non-compliant workloads immediately

Key Technical Advantage:

  • Namespace-label based policy assignment eliminates RBAC complexity
  • Built into API server (no webhook timeouts or external dependencies)
  • Sub-millisecond validation performance (<1ms per pod)

Configuration That Works in Production

Essential Namespace Configuration

apiVersion: v1
kind: Namespace
metadata:
  name: production-workloads
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: v1.29  # CRITICAL: Always pin version
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: v1.29
    pod-security.kubernetes.io/warn: baseline
    pod-security.kubernetes.io/warn-version: v1.29

Critical Configuration Requirements:

  • Always pin version (enforce-version: v1.29) - Kubernetes upgrades change policy rules without warning
  • Use three enforcement modes during rollout:
    • audit: Logs violations without blocking (for discovery)
    • warn: Shows warnings to users (for preparation)
    • enforce: Blocks violating pods (for production)

Security Profile Selection

Profile Use Case Blocks Allows
Privileged System pods, legacy apps Nothing Root users, host access, privileged containers
Baseline Most production workloads Privileged containers, host networking Root users, most capabilities
Restricted Cloud-native apps only Root users, most capabilities, host access Non-root only, read-only root FS

Profile Selection Reality:

  • Privileged: Required for kube-proxy, CNI drivers, most legacy applications
  • Baseline: Where 80% of production workloads end up (developers haven't fixed root user dependencies)
  • Restricted: Only works for applications designed with security from day one

Implementation Failure Scenarios

Critical Migration Failures

PSP to PSA Migration Gotchas:

  • Existing pods continue running but fail to restart when nodes drain/pods crash
  • Friday afternoon PSA enablement → Monday morning half the applications down
  • Missing version pinning → Kubernetes upgrades silently change security policies
  • Global audit mode → Thousands of violation logs flood monitoring systems

Common Production Failures

Pod Rejection Scenarios:

# This will fail in restricted mode - missing security context
spec:
  containers:
  - name: app
    image: myapp:latest
    # ERROR: No securityContext specified

Required Fix for Restricted Mode:

spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
    runAsGroup: 1000
  containers:
  - name: app
    image: myapp:latest
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities:
        drop: ["ALL"]

Hidden Validation Requirements:

  • Both pod AND container security contexts required for restricted mode
  • Init containers must also comply with namespace policy
  • Ephemeral containers validated against same rules
  • Sidecar containers injected by operators can violate policy and block entire pod

Cloud Provider Specific Issues

Amazon EKS:

  • Works as expected, no surprises
  • PSA enabled in privileged mode by default

Google GKE:

  • Standard clusters: Normal PSA behavior
  • Autopilot clusters: Forces baseline mode, cannot override to privileged for user workloads
  • Migration blocker: Legacy monitoring stacks requiring privileged access

Azure AKS:

  • Policy conflict hell: PSA AND Azure Policy can fight each other
  • Confusing error messages: Multiple systems blocking same pod with different reasons
  • Recommendation: Choose PSA OR Azure Policy, not both

Resource Requirements and Costs

Time Investment for Migration

  • Discovery phase: 1-2 weeks running audit mode to identify violations
  • Remediation per application: 2-8 hours depending on security context requirements
  • Testing and validation: 1 week per environment
  • Total migration time: 4-12 weeks for medium-sized clusters

Expertise Requirements

  • Kubernetes security context understanding: Medium complexity
  • YAML debugging skills: Required for violation troubleshooting
  • Namespace organization: Critical for policy boundaries

Hidden Costs

  • Increased namespace count: PSA forces proper workload separation
  • Application refactoring: Legacy apps requiring root access need code changes
  • Monitoring system updates: Need to handle PSA violation logs

Performance and Operational Impact

Performance Characteristics

  • Validation latency: <1ms per pod creation
  • Memory overhead: Negligible (namespace policies cached in memory)
  • CPU impact: Minimal (simple security context comparisons)
  • Scale limit: None identified (scales with API server capacity)

Monitoring Requirements

# Essential monitoring commands
kubectl describe pod <pod-name>  # Shows PSA rejection reasons in events
kubectl get events --field-selector type=Warning  # Shows what would break
kubectl get namespace -o yaml  # Verify which policies are active

Decision Criteria: When PSA is Worth It

PSA vs Alternatives Comparison

Solution Installation Learning Curve Policy Flexibility Maintenance Performance
PSA Built-in Low (3 profiles) Limited to standards None Minimal
OPA Gatekeeper External deployment High (Rego language) Unlimited custom High monitoring overhead Low impact
Falco Daemon deployment Medium Event-based only Daemon management High CPU usage

Use PSA When:

  • Standard security profiles meet requirements
  • Want zero operational overhead
  • Need consistent policy across cloud providers
  • Migrating from deprecated PSPs

Add OPA Gatekeeper When:

  • Need custom compliance policies beyond three standard profiles
  • Require fine-grained per-workload policies within namespaces
  • Compliance frameworks demand specific controls not in PSA

Critical Warnings and Gotchas

What Official Documentation Doesn't Tell You

Version Pinning Critical:

  • Unpinned versions (latest) change behavior during Kubernetes upgrades
  • Policy rules can become stricter without warning
  • Always use specific versions: v1.29 not latest

Namespace Organization Impact:

  • Cannot have different security levels for workloads in same namespace
  • Forces organizational changes to namespace structure
  • Dev/prod workload separation becomes mandatory

Existing Workload Behavior:

  • Running pods unaffected by PSA policy changes
  • Pods fail to restart during maintenance/crashes if they violate new policies
  • Zero-downtime migration requires careful audit mode planning

Breaking Points and Failure Modes

Failure Conditions:

  • Legacy applications requiring root access fail restricted mode
  • Applications needing host filesystem access fail baseline/restricted modes
  • Init containers with privileged requirements break entire pod
  • Sidecar injection by service mesh operators can violate policies

Recovery Strategies:

  • Temporary privileged mode override for emergency deployments
  • Namespace-level policy relaxation during incidents
  • Application-specific namespace creation for incompatible workloads

Migration Strategy for Production

Phase 1: Discovery (Week 1-2)

  1. Enable audit mode with restricted profile globally
  2. Monitor audit logs for violations
  3. Catalog applications by security profile requirements
  4. Identify applications requiring remediation

Phase 2: Preparation (Week 3-6)

  1. Enable warn mode for user feedback
  2. Remediate applications for target security profiles
  3. Create namespace organization plan
  4. Test policy enforcement in staging environments

Phase 3: Enforcement (Week 7-12)

  1. Enable enforcement namespace by namespace
  2. Start with new applications and least critical workloads
  3. Migrate critical production workloads last
  4. Maintain emergency override procedures

Phase 4: Optimization (Ongoing)

  1. Monitor for policy violations
  2. Upgrade applications to higher security profiles when possible
  3. Review and tighten policies based on operational experience

Troubleshooting Guide

Common Error Messages and Solutions

Error: violates PodSecurity "restricted:latest": securityContext.runAsNonRoot != true
Solution: Add runAsNonRoot: true and runAsUser: 1000 to pod security context

Error: violates PodSecurity "baseline:latest": allowPrivilegeEscalation != false
Solution: Set allowPrivilegeEscalation: false in container security context

Error: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false
Solution: Add complete security context with all required fields for restricted mode

Debugging Workflow

  1. Check namespace labels with kubectl get namespace <name> -o yaml
  2. Verify version pinning is correct for cluster version
  3. Review pod security context completeness
  4. Test with kubectl apply --dry-run=server before actual deployment
  5. Use audit mode temporarily to identify all violations

This technical reference provides the operational intelligence needed for successful PSA implementation while avoiding the common pitfalls that cause production failures.

Useful Links for Further Investigation

Essential Pod Security Admission Resources

LinkDescription
Pod Security AdmissionThe official documentation for Pod Security Admission. Comprehensive but dry, it serves as a good reference once you understand the basics.
Pod Security StandardsThis documentation, though dry, is necessary as it tells you exactly what each Pod Security Standard level blocks.
Admission Controllers OverviewA dry but complete overview explaining how Pod Security Admission fits into the broader Kubernetes admission control chain.
Enforcing Pod Security StandardsA best practices guide for implementing Pod Security Standards in production environments, covering gradual rollout strategies and common pitfall avoidance.
Migrate from PodSecurityPolicy to PSAThis is the actual migration guide for transitioning from PodSecurityPolicy to Pod Security Admission. Following it is crucial to avoid weeks of debugging broken policies.
Configure Security ContextThe most useful documentation for fixing Pod Security Admission violations, providing working examples that are proven to be effective.
Namespace Label ConfigurationStep-by-step instructions for applying Pod Security Admission policies using namespace labels, including details on version pinning and enforcement mode configuration.
Amazon EKS Pod Security StandardsAWS-specific guidance for implementing Pod Security Admission in EKS clusters, covering default configurations and integration with AWS security services.
Google GKE Pod Security AdmissionGoogle Cloud documentation for Pod Security Admission implementation in both GKE Standard and Autopilot clusters, including provider-specific configuration options.
Azure AKS Pod SecurityMicrosoft Azure's guide to pod security best practices in AKS, covering Pod Security Admission configuration and Azure Policy integration considerations.
Open Policy Agent GatekeeperOfficial Gatekeeper documentation for Kubernetes, providing details on implementing policy enforcement. Be prepared for the complexities of Rego if choosing this solution.
Falco Runtime SecurityDocumentation for Falco, a runtime security tool that provides continuous monitoring to detect suspicious activity, though it may generate extensive logs.
Pod Security Policy Deprecation NoticeThe official announcement explaining the deprecation of Pod Security Policies and how Pod Security Admission was designed to address the identified issues.
Kubernetes Security SlackAn active community discussion channel for authentication and authorization topics, offering assistance with Pod Security Admission implementation questions and troubleshooting.
Pod Security Standards KEPThe Kubernetes Enhancement Proposal that guided the development of Pod Security Admission, offering detailed context on design decisions and implementation rationale.
Security Context Constraints (OpenShift)Red Hat OpenShift's alternative approach to pod security, which is useful for understanding different implementation strategies and migration considerations.
kubectl dry-runDocumentation for kubectl dry-run, an essential command for testing Pod Security Admission policies safely without making actual changes to your cluster.
PolarisA useful tool for catching Pod Security Admission violations and other misconfigurations before they are deployed to your Kubernetes cluster.
kube-scoreA lighter alternative to Polaris, kube-score effectively catches most Pod Security Admission violations and other common issues before deployment.
CIS Kubernetes BenchmarkIndustry standard security configuration guidelines for Kubernetes, designed to complement and enhance the implementation of Pod Security Standards.
NSA/CISA Kubernetes Hardening GuideGovernment security recommendations for Kubernetes deployment, offering additional context for Pod Security Admission usage within secure environments.

Related Tools & Recommendations

tool
Similar content

Pod Security Standards - Three Security Levels Instead of Policy Hell

Replace the clusterfuck that was Pod Security Policies with simple security profiles

Pod Security Standards
/tool/pod-security-standards/overview
100%
tool
Similar content

GKE Security That Actually Stops Attacks

Secure your GKE clusters without the security theater bullshit. Real configs that actually work when attackers hit your production cluster during lunch break.

Google Kubernetes Engine (GKE)
/tool/google-kubernetes-engine/security-best-practices
85%
tool
Similar content

Pod Security Admission Implementation Guide

Master Kubernetes Pod Security Admission (PSA) with this comprehensive implementation guide. Learn how to enable, configure, troubleshoot, and migrate from PSPs

Pod Security Admission Controller
/tool/pod-security-admission-controller/implementation-guide
48%
tool
Recommended

Open Policy Agent (OPA) - Policy Engine That Centralizes Your Authorization Hell

Stop hardcoding "if user.role == admin" across 47 microservices - ask OPA instead

open-policy-agent
/tool/open-policy-agent/overview
42%
howto
Similar content

Complete Kubernetes Security Monitoring Stack Setup - Zero to Production

Learn to build a complete Kubernetes security monitoring stack from zero to production. Discover why commercial tools fail, get a step-by-step implementation gu

Kubernetes
/howto/setup-kubernetes-security-monitoring/complete-security-monitoring-stack
42%
tool
Similar content

RHACS Security Incident Response

When RHACS catches something nasty in your cluster and you need to figure out what happened

Red Hat Advanced Cluster Security for Kubernetes
/tool/red-hat-advanced-cluster-security-for-kubernetes/security-incident-response
39%
troubleshoot
Similar content

Kubernetes Security Policies Are Blocking Everything - Here's How to Actually Fix It

Learn to diagnose and resolve Kubernetes security policy violations, including PodSecurity and RBAC errors. Get quick triage tips and lasting fixes to unblock y

Kubernetes
/troubleshoot/kubernetes-security-policy-violations/security-policy-violations
39%
tool
Recommended

Amazon EKS - Managed Kubernetes That Actually Works

Kubernetes without the 3am etcd debugging nightmares (but you'll pay $73/month for the privilege)

Amazon Elastic Kubernetes Service
/tool/amazon-eks/overview
38%
tool
Recommended

Google Kubernetes Engine (GKE) - Google's Managed Kubernetes (That Actually Works Most of the Time)

Google runs your Kubernetes clusters so you don't wake up to etcd corruption at 3am. Costs way more than DIY but beats losing your weekend to cluster disasters.

Google Kubernetes Engine (GKE)
/tool/google-kubernetes-engine/overview
38%
tool
Popular choice

jQuery - The Library That Won't Die

Explore jQuery's enduring legacy, its impact on web development, and the key changes in jQuery 4.0. Understand its relevance for new projects in 2025.

jQuery
/tool/jquery/overview
38%
howto
Similar content

Your Kubernetes Cluster is Probably Fucked

Zero Trust implementation for when you get tired of being owned

Kubernetes
/howto/implement-zero-trust-kubernetes/kubernetes-zero-trust-implementation
38%
tool
Similar content

Hardening GKE Enterprise - Security That Actually Works

Secure Google Kubernetes Engine Enterprise (GKE) clusters with this hardening guide. Learn best practices for Workload Identity, Binary Authorization, and the G

Google Kubernetes Engine Enterprise
/tool/gke-enterprise/security-hardening-guide
37%
tool
Similar content

RHACS Compliance Implementation: Stop Panicking When Auditors Show Up

I've been through 5 SOC 2 audits with RHACS. Here's what actually works (and what's complete bullshit)

Red Hat Advanced Cluster Security for Kubernetes
/tool/red-hat-advanced-cluster-security/compliance-implementation-guide
37%
review
Similar content

Container Runtime Security is Where Everything Goes to Hell

I've watched container escapes take down entire production environments. Here's what actually works.

Falco
/review/container-runtime-security/comprehensive-security-assessment
37%
tool
Popular choice

Hoppscotch - Open Source API Development Ecosystem

Fast API testing that won't crash every 20 minutes or eat half your RAM sending a GET request.

Hoppscotch
/tool/hoppscotch/overview
36%
tool
Popular choice

Stop Jira from Sucking: Performance Troubleshooting That Works

Frustrated with slow Jira Software? Learn step-by-step performance troubleshooting techniques to identify and fix common issues, optimize your instance, and boo

Jira Software
/tool/jira-software/performance-troubleshooting
35%
tool
Similar content

kube-bench - Actually Useful K8s Security Auditing

Find out exactly how fucked your cluster security is in under 30 seconds

kube-bench
/tool/kube-bench/overview
34%
tool
Similar content

cert-manager - Stops You From Getting Paged at 3AM Because Certs Expired Again

Because manually managing SSL certificates is a special kind of hell

cert-manager
/tool/cert-manager/overview
34%
tool
Popular choice

Northflank - Deploy Stuff Without Kubernetes Nightmares

Discover Northflank, the deployment platform designed to simplify app hosting and development. Learn how it streamlines deployments, avoids Kubernetes complexit

Northflank
/tool/northflank/overview
33%
tool
Similar content

RHACS Troubleshooting Guide: Fix the Stuff That Breaks

When your security platform decides to become the security problem

Red Hat Advanced Cluster Security for Kubernetes
/tool/red-hat-advanced-cluster-security/troubleshooting-guide
33%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization