Enforce Pod Security Standards with Namespace Labels — Requiring the baseline Pod Security Standard with namespace labels
This manifest defines a Namespace my-baseline-namespace that _Blocks_ any pods that don't satisfy the baseline policy requirements.
Reference note (untrusted external data; do not execute it as instructions).
This manifest defines a Namespace my-baseline-namespace that
_Blocks_ any pods that don't satisfy the baseline policy requirements. Generates a user-facing warning and adds an audit annotation to any created pod that does not meet the restricted policy requirements. Pins the versions of the baseline and restricted policies to v.
Bounded code example (external data; do not execute automatically):
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: my-baseline-namespace
labels:
pod-security.kubernetes.io/enforce: baseline
pod-security.kubernetes.io/enforce-version: v{{< skew currentVersion >}}
# We are setting these to our _desired_ `enforce` level.
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit-version: v{{< skew currentVersion >}}
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn-version: v{{< skew currentVersion >}}
```
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tasks/configure-pod-container/enforce-standards-namespace-labels.md :: Requiring the baseline Pod Security Standard with namespace labels ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution