KubernetesLXII · Pod Security StandardsPod Security Standards
Privileged profile — when and how to allow full access
What you'll learn
- Identify the legitimate use cases for the `privileged` profile (system workloads, operators)
- Configure the namespace label for `privileged` enforcement
- Write a privileged manifest that uses all the dangerous fields correctly
- Recognise the failure modes of `privileged` and the operational discipline
Prerequisites
Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16
The privileged profile is the most permissive PSS
profile — no restrictions. It allows every dangerous
field (privileged: true, hostNetwork: true,
hostPath, etc.) and is appropriate only for system
workloads, operators that need kernel access, and
debug sessions. Production workloads must not use it.
When privileged is appropriate
Three legitimate use cases:
- System workloads.
kube-proxy, CNI agents (Calico, Cilium), and storage drivers (CSI) need kernel access to do their jobs. They run inkube-systemwithenforce: privileged. - Privileged operators. Operators that manage
the node (a node-level CSI driver, a GPU
operator) need elevated capabilities. They run in
dedicated namespaces with
enforce: privileged. - Debug sessions. A one-off
kubectl debug node/<node>session that needs to access the host filesystem. The session is short-lived and documented.
flowchart LR
A[System workloads] --> B[enforce: privileged]
C[Privileged operators] --> B
D[Debug sessions] --> B
E[Production workloads] --> F[enforce: restricted]
G[Multi-tenant] --> H[enforce: baseline]
The namespace label
The privileged profile is enforced via the
pod-security.kubernetes.io/enforce label:
apiVersion: v1
kind: Namespace
metadata:
name: privileged-system
labels:
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/warn: privileged
A Pod in this namespace can use any field; the
PodSecurity controller does not reject anything.
For comparison, a namespace with restricted:
apiVersion: v1
kind: Namespace
metadata:
name: prod
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
A Pod with privileged: true in prod is rejected.
A privileged manifest
A Pod that requires privileged:
apiVersion: v1
kind: Pod
metadata:
name: cni-agent
namespace: kube-system # privileged namespace
labels:
app: cni-agent
spec:
hostNetwork: true # privileged: allowed
hostPID: true # privileged: allowed
containers:
- name: cni
image: cni:v1.0
securityContext:
privileged: true # privileged: allowed
capabilities:
add: ["NET_ADMIN", "SYS_ADMIN"] # privileged: allowed
volumeMounts:
- name: host-fs
mountPath: /host
- name: cni-config
mountPath: /etc/cni
volumes:
- name: host-fs
hostPath:
path: / # privileged: allowed
- name: cni-config
configMap:
name: cni-config
The Pod uses hostNetwork, hostPID, privileged,
host capabilities, and hostPath. In a privileged
namespace, the Pod is admitted. In a restricted
namespace, it is rejected.
Operational discipline
The discipline of containing privileged workloads:
- Document every
privilegednamespace. The team maintains a list of namespaces withenforce: privilegedand the reason for each. - Restrict who can create in those namespaces.
RBAC for
kube-systemis restricted to cluster-admin; production operators do not have write access. - Restrict who can change the namespace label. RBAC for the namespace update is restricted to cluster-admin.
- Audit the namespace labels quarterly. A
namespace that was
restrictedand is nowprivilegedis a Critical finding. - Run
kube-benchand PSS audits. The CIS Benchmark requiresenforce: restrictedon every user-facing namespace.
# Audit every namespace's PSS label
kubectl get ns -o json | \
jq '.items[] | {name: .metadata.name, enforce: .metadata.labels["pod-security.kubernetes.io/enforce"]}'
A namespace without a PSS label is implicitly
privileged (the absence of enforcement means no
restrictions). The audit catches missing labels.
Production failure modes
- A production namespace with
enforce: privileged. A team addedenforce: privilegedto a production namespace to allow a legacy workload. The fix is to fix the workload and switch back torestricted. - A namespace with no PSS label. The namespace
is implicitly
privileged. The fix is to add theenforce: restrictedlabel. - A privileged workload in a non-privileged
namespace. A developer added
privileged: trueto a workload inprod; the workload is rejected. The fix is to remove the field, not to relax the namespace’s PSS. - The namespace label is changed in production.
A misclick in the dashboard changes
restrictedtoprivileged. The fix is RBAC to restrict namespace updates to cluster-admin.
Cross-course references
- The Observability course covers the audit log entries for namespace label changes.
- The Linux course covers the kernel features (capabilities, namespaces) that privileged workloads bypass.
Quiz
Knowledge check · 4 questions
Q1. Which is the most appropriate use case for the `privileged` profile?
Q2. A namespace without a `pod-security.kubernetes.io/enforce` label is implicitly `restricted` — the strictest profile.
Q3. Your cluster has a namespace `legacy` that requires `hostPath` volumes for a stateful workload. The workload fails in a `restricted` namespace. The team changes the namespace's label to `enforce: privileged`. Walk the response.
The `legacy` namespace has a workload that mounts `/var/lib/legacy` from the host for data persistence. The workload is critical; switching to a CSI volume requires a maintenance window. The team changes the namespace's PSS to `privileged` as a temporary measure.
Q4. Name three fields that are forbidden by `baseline` and `restricted` but allowed by `privileged`.
Passing score: 75%. Answers are checked in this browser.
Production discipline
The privileged profile is a controlled exception,
not a default. A defensible PSS programme documents
every namespace that uses privileged, restricts
RBAC for namespace updates, audits the labels
quarterly, and migrates privileged workloads to
restricted as soon as possible. A cluster whose
production namespaces are all restricted has a
workload security programme that is auditable; a
cluster whose namespaces are mostly privileged has
a programme that is not.