Pulumi Kubernetes PodSecurityPolicy permits privileged execution

Do not permit privileged execution for ordinary workloads through PodSecurityPolicy.

Description

In Pulumi YAML, privileged: true lets this PSP admit a Pod that requests privileged mode. The requesting user or the Pod’s service account needs use permission on the PSP.

Potential impact

A compromised privileged container’s access to kernel functions and node resources can affect other workloads.

Remediation

Set privileged: false in the legacy PSP. Check whether system tasks can run with narrower capabilities. Confine any necessary exceptions to separate policies and nodes, and review host access separately.

Examples

The excerpts omit other required fields of the policy/v1beta1 PSP. Kubernetes deprecated it in 1.21 and removed it in 1.25. On current clusters, enforce the restriction with Pod Security Admission or a policy engine, then test that ordinary Pods start and privileged Pods are rejected.

Before

yaml
name: aws-eks
runtime: yaml
resources:
  example:
    type: kubernetes:policy/v1beta1:PodSecurityPolicy
    properties:
      metadata:
        name: example
      spec:
        privileged: true

After

yaml
name: aws-eks
runtime: yaml
resources:
  example:
    type: kubernetes:policy/v1beta1:PodSecurityPolicy
    properties:
      metadata:
        name: example
      spec:
        privileged: false

References