Description
In a legacy PodSecurityPolicy (PSP), privileged: true permits a Pod to request privileged containers. The requesting user or the Pod’s service account must have use permission on that policy. Kubernetes deprecated PSP in 1.21 and removed it in 1.25.
Potential impact
A privileged Linux container receives all capabilities and broad access to host devices. A compromised container can affect other workloads on the node.
Remediation
Set privileged: false in the legacy PSP and remove privileged mode from workloads. On Kubernetes 1.25 or later, enforce the Baseline or Restricted Pod Security Standard in the namespace, or use an equivalent policy. Limit exceptions to essential system tools and restrict individual capabilities, hostPath and host namespace access.
Examples
These excerpts show only the privileged setting. Check that ordinary workloads start and a test Pod requesting privileged mode is rejected.
Before
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: example
spec:
privileged: true
After
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: example
spec:
privileged: false