Sub topic 13
What PSA does not do, and when to add other tools
This chapter assumes you can apply Pod Security Admission (PSA) namespace labels and read a Pod securityContext. It covers what PSA cannot enforce and which tools fill those gaps.
What PSA is built to do
PSA checks Pod specs against three fixed profiles (Privileged, Baseline, Restricted). It runs inside the API server, needs no extra components, and works per namespace through labels. That simplicity is also its limit. The profiles are fixed by the Kubernetes project, and you can only choose a level and a mode.
Gaps you will hit
No custom rules
You cannot write your own checks. PSA cannot require an image from a specific registry, demand a team label, enforce resource limits, or forbid the latest tag. It only knows the controls defined in the Pod Security Standards.
No mutation
PSA only accepts or rejects. It will not add runAsNonRoot: true or drop capabilities for you. If a Pod is rejected, a person or a pipeline must fix the manifest.
Coarse scope
Policy applies to a whole namespace. You cannot say "Restricted for these Pods but Baseline for that one" in the same namespace. The exemption options in the admission configuration work by user name, runtime class, or namespace, not by Pod.
Only Pods are checked
PSA evaluates Pod specs. It does not check Services, Ingresses, RBAC objects, NetworkPolicies, or ConfigMaps. For workload resources such as Deployments, only warn and audit apply to the template. A Deployment is still created even if its Pods will be blocked, so you only see the failure when the ReplicaSet tries to create Pods.
Not a runtime control
PSA runs at admission time. It does not watch running containers, detect attacks, or restrict system calls beyond requiring a seccomp profile. Changing a namespace label does not evict Pods that already run. Existing Pods are only checked again if they are updated in ways that touch security-relevant fields.
Not a network or supply-chain control
Pod Security Standards say nothing about which Pods can talk to each other, whether an image is signed, or whether it has known vulnerabilities.
Choosing complementary tools
| Need | Typical tool |
|---|---|
| Custom admission rules, mutation, per-Pod exceptions | Kyverno, OPA Gatekeeper, or a ValidatingAdmissionPolicy |
| Traffic restrictions between Pods | NetworkPolicy (with a CNI that enforces it) |
| Image signing and registry rules | Admission policy engines with image verification |
| Detecting suspicious behavior at runtime | Runtime security tools such as Falco |
| Limits on API access | RBAC |
| Resource consumption | ResourceQuota and LimitRange |
ValidatingAdmissionPolicy is built into the API server and uses CEL expressions, so it is a good first step when you need a custom rule but do not want to run another component. Kyverno and Gatekeeper add richer features such as mutation, generating resources, and reporting.
A practical layering example
A reasonable setup keeps PSA as the baseline and adds only what you need. Enforce baseline or restricted through namespace labels. Add a policy for rules PSA cannot express. The example below uses a ValidatingAdmissionPolicy to require resource limits on every container.
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
name: require-cpu-memory-limits
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["pods"]
validations:
- expression: >-
object.spec.containers.all(c,
has(c.resources) && has(c.resources.limits) &&
'cpu' in c.resources.limits && 'memory' in c.resources.limits)
message: "Every container must set CPU and memory limits."
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
name: require-cpu-memory-limits-binding
spec:
policyName: require-cpu-memory-limits
validationActions: ["Deny"]
matchResources:
namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: paymentsPSA handles the security profile, and this policy handles a rule PSA has no concept of.
Common mistakes
- Assuming a labeled namespace protects Pods that were already running. Review existing Pods separately.
- Relying on
warnorauditalone and expecting blocking. Onlyenforcerejects Pods. - Treating PSA as a full security program. It is one admission check among several layers.
Exercise
A team needs every Pod in the payments namespace to use images only from registry.example.com, and the namespace already enforces the Restricted profile. Can PSA do this? What would you add?
Show answer
No. PSA only checks the controls in the Pod Security Standards and has no rule about image registries. Keep Restricted enforced through the namespace labels, and add a custom admission policy, such as a ValidatingAdmissionPolicy with a CEL expression on container images, or a Kyverno or Gatekeeper policy.