What this thread does
Preview Restricted admission for one application namespace, fix its Pod templates, then add explicit network isolation.
Do first: preview what Restricted would reject
As of November 2026 (2026-11-08), this guide targets Kubernetes 1.36, kubectl 1.36 and Linux application Pods. Replace app with your application namespace:
kubectl label ns app --dry-run=server --overwrite pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/enforce-version=v1.36
Does the response identify incompatible existing Pods? Start with branch 1; if it does not, proceed to branch 2. This preview leaves namespace labels unchanged and reports how current Pods compare with the policy; it does not prove every future Pod template will be admitted. Kubernetes 1.36 namespace-label guide
1. The preview flags privileges → repair the Pod template
Kubernetes 1.36, Restricted policy v1.36: follow the Pod Security Standards tables. Merge this fragment into the Deployment's existing template; preserve its real image, ports, volumes and container list:
spec:
template:
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: api
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
Use an image that supports a non-root user; an image declaring root needs an appropriate image/user change. Inspect init containers, sidecars and container-level overrides too. This fragment is not the entire Restricted policy: privileged containers, host namespaces, disallowed volumes and probe/lifecycle host fields can still fail admission. Pinning the policy prevents a future minor release from silently changing the selected rules.
Apply the complete corrected Deployment manifest. In a namespace with Restricted enforcement, require newly created replacement Pods to be admitted and become Ready; inspect ReplicaSet events if creation fails. Saving a Deployment object alone is not proof its child Pods can be created.
2. Templates are compatible → enforce the pinned standard
Kubernetes 1.36: follow namespace enforcement. After resolving the preview warnings:
kubectl label ns app --overwrite pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/enforce-version=v1.36 pod-security.kubernetes.io/warn=restricted pod-security.kubernetes.io/warn-version=v1.36
kubectl get ns app --show-labels
Require the intended labels, then perform an ordinary controlled rollout and inspect its new Pods. Existing noncompliant Pods are not evicted merely because labels change; future Pod creation is where enforcement matters. Use a representative disposable application namespace before changing a shared one. Admission exemptions require administrator review; a namespace label alone cannot establish that none apply. Pod Security Admission
3. Pods still write to the image filesystem → restrict writable paths
Kubernetes 1.36: follow securityContext. Restricted admission does not itself require readOnlyRootFilesystem. Add this to each compatible container, and mount only the paths it needs to write:
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- name: scratch
mountPath: /tmp
Add volumes: [{name: scratch, emptyDir: {}}] at the Pod spec level. If the application writes elsewhere, map those exact paths and permissions instead of making the root filesystem writable again. A read-only image filesystem does not make mounted volumes read-only.
Roll out the complete manifest. Exercise startup and write-dependent requests, inspect container logs for permission failures, and inspect the resulting Pod YAML for the intended mount and security context. Only choose a numeric runAsUser/fsGroup after matching the image and volume ownership; an arbitrary UID can break startup. Pod and container context settings
4. Admitted Pods can reach unrelated services → isolate traffic
Kubernetes 1.36, networking.k8s.io/v1: use Network Policies. First confirm your CNI enforces NetworkPolicy. Start with an application selector in a disposable namespace, after defining the required ingress and egress allow policies:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: isolate-api
namespace: app
spec:
podSelector:
matchLabels:
app: api
policyTypes: [Ingress, Egress]
This policy adds no allowed connections. Existing policies are additive, so an existing broad allow can still permit traffic. Create explicit rules for actual client selectors, backend destinations and ports before using it on a live service. Egress isolation also needs an allowance for your cluster's DNS path; identify that path rather than assuming a DNS Pod label.
After applying the policies, open new connections from one allowed client and one unallowed Pod; require the intended API/backend/DNS traffic to succeed and unrelated connections to fail. Use TCP/UDP service checks, not ping, as the decision. An accepted NetworkPolicy object without an enforcing CNI provides no traffic isolation. Policy semantics and DNS warning
Evidence and limits
The Kubernetes 1.36 release announcement, 2026-04-22 dates this version scope. Independent application evidence: dronenb's OpenShift CLI report #2138, 2025-11-07 records generated Pods rejected for missing privilege-escalation, capability and non-root settings. This is evidence of the admission failure pattern, not instructions for OpenShift SCC or a 1.36-specific regression.
Pod Security Admission validates Pod configuration; it does not replace RBAC, image trust, secret access controls or network enforcement. Privileged infrastructure agents may need separate namespaces and a reviewed policy. The context examples here target Linux; Windows security controls differ. Admission scope and exemptions
Not for: Docker Compose stack selection; see kubernetes-nomad-ecs-fly-or-docker-compose-for-a-small-team-2026.
Started from a post by @Kubernetes, packaged by the editor. Original post