Skip to main content

More Info:

Setting a limit on pod PIDs prevents a single pod from exhausting process resources on the node. This protects other workloads from process-based denial of service.

Risk Level

Low

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Determine your desired PID limit per pod
    • Run on: any worker node (for planning)
    • Choose a value that fits your workload (for example: 1024). You will use this value for podPidsLimit (config file) or --pod-max-pids (flag).
  2. Check how kubelet is configured (config file vs flags)
    • Run on: every worker node
    • If you see --pod-max-pids in the kubelet command line, you will adjust the systemd unit (step 4).
    • If kubelet is using --config=/var/lib/kubelet/config.yaml and the file has a KubeletConfiguration object, you will adjust that file (step 3).
  3. Set PodPidsLimit in /var/lib/kubelet/config.yaml (config-file based setups)
    • Run on: every worker node
    • Edit the file:
    • Under the top-level KubeletConfiguration, add or modify the podPidsLimit field (replace 1024 with your chosen value):
    • Save the file.
  4. Set —pod-max-pids flag in the kubelet systemd unit (flag-based setups)
    • Run on: every worker node
    • Edit the systemd drop-in or unit that defines kubelet arguments (path may differ by distro; common examples):
    • Add or update --pod-max-pids in the kubelet arguments (replace 1024 with your chosen value). For example, in a drop-in file:
    • Or append --pod-max-pids=1024 to an existing ExecStart= line that launches kubelet.
    • Reload systemd configuration:
  5. Restart kubelet to apply the new limit
    • Run on: every worker node
    • Impact: restarting kubelet can temporarily disrupt node status and pod management on that node.
  6. Verify kubelet is running with a pod PIDs limit
    • Run on: every worker node
    • Confirm either:
      • The output command line includes --pod-max-pids=1024 (or your chosen value), or
      • Kubelet is using --config=/var/lib/kubelet/config.yaml and the file contains podPidsLimit: 1024 as configured in step 3.
kubectl cannot be used to set the kubelet PodPidsLimit or --pod-max-pids value, because this is a host-level kubelet configuration in /var/lib/kubelet/config.yaml or the kubelet systemd unit on every worker node. Make the change directly on each worker node’s kubelet configuration as described in the Manual Steps section.