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
notlatest
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)
- Enable audit mode with restricted profile globally
- Monitor audit logs for violations
- Catalog applications by security profile requirements
- Identify applications requiring remediation
Phase 2: Preparation (Week 3-6)
- Enable warn mode for user feedback
- Remediate applications for target security profiles
- Create namespace organization plan
- Test policy enforcement in staging environments
Phase 3: Enforcement (Week 7-12)
- Enable enforcement namespace by namespace
- Start with new applications and least critical workloads
- Migrate critical production workloads last
- Maintain emergency override procedures
Phase 4: Optimization (Ongoing)
- Monitor for policy violations
- Upgrade applications to higher security profiles when possible
- 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
- Check namespace labels with
kubectl get namespace <name> -o yaml
- Verify version pinning is correct for cluster version
- Review pod security context completeness
- Test with
kubectl apply --dry-run=server
before actual deployment - 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
Link | Description |
---|---|
Pod Security Admission | The official documentation for Pod Security Admission. Comprehensive but dry, it serves as a good reference once you understand the basics. |
Pod Security Standards | This documentation, though dry, is necessary as it tells you exactly what each Pod Security Standard level blocks. |
Admission Controllers Overview | A dry but complete overview explaining how Pod Security Admission fits into the broader Kubernetes admission control chain. |
Enforcing Pod Security Standards | A best practices guide for implementing Pod Security Standards in production environments, covering gradual rollout strategies and common pitfall avoidance. |
Migrate from PodSecurityPolicy to PSA | This 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 Context | The most useful documentation for fixing Pod Security Admission violations, providing working examples that are proven to be effective. |
Namespace Label Configuration | Step-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 Standards | AWS-specific guidance for implementing Pod Security Admission in EKS clusters, covering default configurations and integration with AWS security services. |
Google GKE Pod Security Admission | Google Cloud documentation for Pod Security Admission implementation in both GKE Standard and Autopilot clusters, including provider-specific configuration options. |
Azure AKS Pod Security | Microsoft Azure's guide to pod security best practices in AKS, covering Pod Security Admission configuration and Azure Policy integration considerations. |
Open Policy Agent Gatekeeper | Official Gatekeeper documentation for Kubernetes, providing details on implementing policy enforcement. Be prepared for the complexities of Rego if choosing this solution. |
Falco Runtime Security | Documentation for Falco, a runtime security tool that provides continuous monitoring to detect suspicious activity, though it may generate extensive logs. |
Pod Security Policy Deprecation Notice | The official announcement explaining the deprecation of Pod Security Policies and how Pod Security Admission was designed to address the identified issues. |
Kubernetes Security Slack | An active community discussion channel for authentication and authorization topics, offering assistance with Pod Security Admission implementation questions and troubleshooting. |
Pod Security Standards KEP | The 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-run | Documentation for kubectl dry-run, an essential command for testing Pod Security Admission policies safely without making actual changes to your cluster. |
Polaris | A useful tool for catching Pod Security Admission violations and other misconfigurations before they are deployed to your Kubernetes cluster. |
kube-score | A lighter alternative to Polaris, kube-score effectively catches most Pod Security Admission violations and other common issues before deployment. |
CIS Kubernetes Benchmark | Industry standard security configuration guidelines for Kubernetes, designed to complement and enhance the implementation of Pod Security Standards. |
NSA/CISA Kubernetes Hardening Guide | Government security recommendations for Kubernetes deployment, offering additional context for Pod Security Admission usage within secure environments. |
Related Tools & Recommendations
Pod Security Standards - Three Security Levels Instead of Policy Hell
Replace the clusterfuck that was Pod Security Policies with simple security profiles
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.
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
Open Policy Agent (OPA) - Policy Engine That Centralizes Your Authorization Hell
Stop hardcoding "if user.role == admin" across 47 microservices - ask OPA instead
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
RHACS Security Incident Response
When RHACS catches something nasty in your cluster and you need to figure out what happened
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
Amazon EKS - Managed Kubernetes That Actually Works
Kubernetes without the 3am etcd debugging nightmares (but you'll pay $73/month for the privilege)
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.
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.
Your Kubernetes Cluster is Probably Fucked
Zero Trust implementation for when you get tired of being owned
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
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)
Container Runtime Security is Where Everything Goes to Hell
I've watched container escapes take down entire production environments. Here's what actually works.
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.
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
kube-bench - Actually Useful K8s Security Auditing
Find out exactly how fucked your cluster security is in under 30 seconds
cert-manager - Stops You From Getting Paged at 3AM Because Certs Expired Again
Because manually managing SSL certificates is a special kind of hell
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
RHACS Troubleshooting Guide: Fix the Stuff That Breaks
When your security platform decides to become the security problem
Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization