Skip to main content
Cloud DevOps Solutions
Get a quote Talk to an engineer

AWS EKS Consulting

Pod Security Standards on EKS: Enforcing Baseline or Restricted

We enforce Kubernetes Pod Security Standards on EKS using the built-in Pod Security Admission controller. Namespaces get Baseline or Restricted profiles, rolled out in audit and warn mode first, with documented exemptions for system components and a policy engine for rules the standards do not cover.

Key takeaways

  • Pod Security Standards define three profiles: Privileged, Baseline and Restricted, applied per namespace through labels.
  • Pod Security Admission is built into Kubernetes and replaced the removed PodSecurityPolicy.
  • Rolling out audit and warn first shows what would break before anything is blocked.
  • Restricted is the target for application namespaces, Baseline is a realistic first step for legacy workloads.
  • Admission standards do not cover everything, so we add a policy engine for image, registry and label rules.

What a permissive pod can do

A pod specification is a request to run code on a node, and Kubernetes will honour a lot by default. A container can run as root, mount the host filesystem, share the host network, add Linux capabilities or run privileged. Any one of those can turn a single application bug into node compromise, and from the node an attacker can reach other pods and credentials.

Pod Security Standards (PSS) are the built-in guardrail. This page describes how we apply them as part of AWS EKS consulting. They are one layer of our wider EKS security work, alongside network policies and least-privilege IAM.

The three profiles

ProfileIntentTypical use
PrivilegedNo restrictionsCNI, storage drivers, node agents
BaselineBlocks known privilege escalationsLegacy apps, a stepping stone
RestrictedHardened, current best practiceApplication namespaces

Baseline prevents things like privileged containers, host networking and host paths. Restricted adds requirements: containers must run as non-root, disallow privilege escalation, drop all capabilities (adding back only NET_BIND_SERVICE) and use a runtime default or localhost seccomp profile.

How enforcement works

The Pod Security Admission controller ships with Kubernetes and is enabled on EKS. You apply labels to a namespace to choose the mode and profile:

  • enforce: reject violating pods.
  • audit: allow, but record a violation in the audit log.
  • warn: allow, but show a warning to the user.
kubectl label namespace payments \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/audit-version=latest \
  pod-security.kubernetes.io/warn=restricted \
  pod-security.kubernetes.io/warn-version=latest \
  --overwrite

# once clean, switch on enforcement and pin a version
kubectl label namespace payments \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/enforce-version=v1.30 \
  --overwrite

Pinning the version avoids surprises when a new Kubernetes release tightens a profile. A dry run is also available: kubectl label --dry-run=server --overwrite ns --all pod-security.kubernetes.io/enforce=baseline reports which existing namespaces would have violations.

An audit-first rollout

Switching on enforcement across a live cluster is how teams break deployments. We go in this order:

  1. Apply warn and audit on every namespace and read the output for a representative period.
  2. Group the findings by cause: root users, missing seccomp, added capabilities, host paths.
  3. Fix manifests first (usually a securityContext block), then base images that insist on root.
  4. Move system components into labelled namespaces with the profile they actually need.
  5. Enable enforce namespace by namespace, starting with the least critical.

A compliant container security context looks like this:

securityContext:
  runAsNonRoot: true
  runAsUser: 10001
  allowPrivilegeEscalation: false
  capabilities:
    drop: ["ALL"]
  seccompProfile:
    type: RuntimeDefault

Pair it with a pod-level fsGroup where volumes need group access, and with readOnlyRootFilesystem: true where the application permits. That last setting is not required by Restricted but is a cheap extra hardening step.

Where PSS is not enough

PSS looks at pod specs and nothing else. It does not check which registry an image comes from, whether resource requests exist, whether labels are present or whether a service type is allowed. For those we add policy as code:

  • Kyverno uses Kubernetes-style YAML policies and suits teams that want readable rules and mutation, such as injecting default security contexts.
  • OPA Gatekeeper uses Rego, which is powerful but has a steeper learning curve.
  • ValidatingAdmissionPolicy is built into recent Kubernetes versions and avoids a webhook component for simpler rules.

We usually choose one engine, not several. Policies are written to the same standards we apply in CI, where tools such as kube-linter or Checkov can catch failures before merge. Related access control concepts are explained in the Kubernetes RBAC glossary entry.

Common failure modes

  • Third-party Helm charts that run as root. We override values, pick alternative images, or isolate the chart in a Baseline namespace with a documented reason.
  • Init containers forgotten. They are checked against the profile too.
  • Add-on namespaces labelled Restricted by accident, breaking the CNI or CSI driver. System namespaces are labelled deliberately.
  • Stale exemptions. We record each exemption with an owner and review date.
  • Webhook availability: if a policy engine is down and fails closed, deployments stop. We run it with replicas and sensible failure policies.

A worked example: a Helm chart that runs as root

A typical case: a third-party chart for an internal tool deploys a container whose image expects to run as root and write into its own filesystem. In audit mode the namespace reports several violations at once: root user, no seccomp profile, privilege escalation allowed. We work through them in order of effort. The seccomp profile and privilege escalation settings are usually one-line values changes. The root user is harder, because the image may write to paths owned by root.

Our options, in order of preference: set a non-root user and mount an emptyDir at the paths that need to be writable, switch to a maintained image variant that already runs unprivileged, or build a thin derived image that fixes file ownership. If none of those works, the workload goes into a separate Baseline namespace with the reason and an owner recorded, so the exception is visible instead of quietly weakening the whole cluster.

Exemptions and system namespaces

Pod Security Admission can be configured with exemptions for particular namespaces, users or runtime classes. We use them sparingly. Exempting a whole namespace is easier to audit than exempting a user, and every exemption is written down with an owner and a review date.

When not to start here

If your cluster has no network segmentation, no IAM isolation and no image scanning, PSS is still worth enabling, but it is not the first thing that will reduce risk. We rank controls by exposure and effort during a security review, and sometimes start with IAM or public endpoint exposure instead.

Delivery and handover

You get namespace labels and policies in Git, a table of exceptions with reasons, updated manifests or chart values for affected workloads, and a developer guide with a compliant securityContext template. New services should pass by default.

How to tell it is working

Try to deploy a privileged pod in an application namespace: it must be rejected. Track audit violations over time, which should trend to zero, and check that every exemption has an owner. To discuss your starting point, book a consultation.

References

How we deliver it

  1. 01

    Classify namespaces

    We group namespaces into system, platform and application tiers with a target profile for each.

  2. 02

    Run in audit and warn

    Labels are applied in non-enforcing modes to list the violations without blocking deployments.

  3. 03

    Fix workloads

    Manifests and images are updated: non-root users, dropped capabilities, seccomp profiles and no privilege escalation.

  4. 04

    Handle exceptions

    Genuinely privileged components are isolated in their own namespaces with written justification.

  5. 05

    Enforce

    The enforce label is switched on namespace by namespace, with the version pinned.

  6. 06

    Add policy as code

    Kyverno or a similar engine covers extra rules, and CI checks manifests before they reach the cluster.

Tools and technologies

Pod Security AdmissionKyvernoOPA Gatekeeperkubectlkube-linterTrivyCheckovseccompAmazon EKSKubernetes Validating Admission Policy

Frequently asked questions

What are the Kubernetes Pod Security Standards?
They are three predefined security profiles for pods. Privileged is unrestricted, Baseline blocks known privilege escalations such as host namespaces and privileged containers, and Restricted follows current hardening practice, including running as non-root with dropped capabilities. They are enforced by the Pod Security Admission controller using namespace labels.
Baseline or Restricted: which should we use?
Aim for Restricted in application namespaces, since most modern web services can meet it with modest changes. Use Baseline where legacy images need more freedom, then migrate. System namespaces with CNI, storage or monitoring agents often need Privileged and should be isolated and limited.
What replaced PodSecurityPolicy?
PodSecurityPolicy was removed in Kubernetes 1.25. Pod Security Admission, which is built in and label-driven, replaced it for simple cases. For richer or custom rules, teams use policy engines such as Kyverno or OPA Gatekeeper, or Kubernetes ValidatingAdmissionPolicy.
Will enforcing Restricted break our workloads?
It will block pods that run as root, add capabilities or lack a seccomp profile, which is why we start with audit and warn modes. Findings tell us which images and manifests need changes. Enforcement is switched on only when a namespace reports clean.
Are Pod Security Standards enough on their own?
No. They govern pod specs, not image provenance, registries, resource limits or RBAC. We combine them with network policies, least-privilege IAM and a policy engine, so each layer covers what the others cannot.

Talk to an engineer about pod security standards eks

Book a free 30-minute call. We review your current setup and tell you honestly whether and how we can help.

Written by Saddique Khan, DevOps / SRE / Cloud Consultant Engineer. Last updated 2026-10-08.