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
LowAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
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).
-
Check how kubelet is configured (config file vs flags)
- Run on: every worker node
- If you see
--pod-max-pidsin the kubelet command line, you will adjust the systemd unit (step 4). - If kubelet is using
--config=/var/lib/kubelet/config.yamland the file has aKubeletConfigurationobject, you will adjust that file (step 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 thepodPidsLimitfield (replace1024with your chosen value):
- Save the file.
-
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-pidsin the kubelet arguments (replace1024with your chosen value). For example, in a drop-in file:
- Or append
--pod-max-pids=1024to an existingExecStart=line that launches kubelet. - Reload systemd configuration:
-
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.
-
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.yamland the file containspodPidsLimit: 1024as configured in step 3.
- The output command line includes
Using kubectl
Using kubectl
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.Automation
Automation

