Skip to content

KEP-6063: Update minimum per-pod PID limit from 1024 to 128 - #6217

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
BhargaviGudi:kep-6063-minPID
Jul 27, 2026
Merged

KEP-6063: Update minimum per-pod PID limit from 1024 to 128#6217
kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
BhargaviGudi:kep-6063-minPID

Conversation

@BhargaviGudi

@BhargaviGudi BhargaviGudi commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Lowers the minimum allowed value for spec.resources.limits.pid from 1024 to 128, based on
empirical PID usage measurements on an OpenShift cluster.

KEP: #6064
Discussion regrading minimum PID limit: #6064 (comment)

Justification

Created a multi-container pod (multi-container-pid-test in namespace pid-measure-test) with 7 containers: 3× busybox, nginx, alpine, redis, and curl. The pod was configured with exec liveness/readiness probes on all containers and PreStop hooks that spawn background processes. All seven containers ran successfully.

Total PIDs used by the pod were measured from the pod cgroup on the worker node:

PID Usage Testing Results

Tested multi-container pods with exec probes and PreStop hooks on OpenShift cluster.

Test Configuration

  • multi-container-pid-test: 7 containers with exec liveness/readiness probes + PreStop hooks
  • baseline-multi-container: Same 7 containers, no probes (baseline)
  • intensive-exec-probes: Single container with aggressive exec probes (5s intervals)

Results (cgroup measurements)

Pod Configuration Containers pids.current pids.peak
Multi-container + exec probes 7 36 47
Baseline (no probes) 7 26 30
Intensive exec probes 1 12 20

Exec Probe/Hook Overhead

  • Baseline: 30 PIDs peak
  • With exec probes/hooks: 47 PIDs peak
  • Overhead: ~17 PIDs

Pod-level cgroup (authoritative):

  pids.current: 36
  pids.peak: 47
  pids.max: 4096

A minimum of 128 provides adequate headroom: ~2.7× over the observed maximum (47 PIDs peak) for a complex multi-container pod with exec probes and PreStop hooks, and ~5× for baseline multi-container workloads (25-30 PIDs). This is sufficient for any standard workload while still allowing meaningful restriction of PID-intensive or untrusted processes.

@kubernetes-prow kubernetes-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 30, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @BhargaviGudi. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 30, 2026
@kubernetes-prow kubernetes-prow Bot added kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jun 30, 2026
@SergeyKanzhelev

Copy link
Copy Markdown
Member

with 7 containers: 3× busybox (sleep), nginx, alpine (sleep), redis, and curl (sleep).

Any exec probes or exec pre-stop hooks? exec into container takes like surprisingly a lot of PIDs.

@BhargaviGudi
BhargaviGudi marked this pull request as ready for review July 1, 2026 04:50
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2026
@BhargaviGudi
BhargaviGudi marked this pull request as draft July 1, 2026 04:50
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2026
@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

with 7 containers: 3× busybox (sleep), nginx, alpine (sleep), redis, and curl (sleep).

Any exec probes or exec pre-stop hooks? exec into container takes like surprisingly a lot of PIDs.

Tested with exec probes and PreStop hooks - added details to description.
Peak usage with 7 containers + exec probes + hooks: 47 PIDs (2.7× below 128 minimum).
Exec overhead: ~17 PIDs compared to baseline.

@BhargaviGudi
BhargaviGudi marked this pull request as ready for review July 1, 2026 13:57
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from mrunalp July 1, 2026 13:57
@SergeyKanzhelev

Copy link
Copy Markdown
Member

Exec overhead: ~17 PIDs compared to baseline.

17 is not divisible by 7. Was it perhaps 3 PIDs per probe as an absolute worst case than? If so, 7 containers x 2 probe types (readiness and liveness) x 3 processes per probe = 42. This is still lower than 100, so sounds good. Thank you for checking.

/lgtm
/assign @mrunalp

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 1, 2026
@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

17 is not divisible by 7. Was it perhaps 3 PIDs per probe as an absolute worst case than? If so, 7 containers x 2 probe types (readiness and liveness) x 3 processes per probe = 42. This is still lower than 100, so sounds good. Thank you for checking.

The 17 is the measured overhead (47 peak - 30 baseline), not a per-container calculation.
I ran additional testing with 7 identical containers (all busybox), each with 2 exec probes (liveness + readiness):
Per-container: Each has 5 PIDs
Pod total (cgroup):

  • pids.current: 14 PIDs (steady state)
  • pids.peak: 32 PIDs (when probes execute)

Analysis:

  • Each container: ~2 PIDs base (sleep process + container runtime)
  • During probe execution: adds ~3-4 PIDs per probe
  • 7 containers × 2 probes × ~2 PIDs per probe = ~28 PIDs
  • Actual peak: 32 PIDs - Very close! - lower than 100

@SergeyKanzhelev

Copy link
Copy Markdown
Member

yep, we are on the same page.

@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@kubernetes-prow

Copy link
Copy Markdown
Contributor

@BhargaviGudi: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ngopalak-redhat

Copy link
Copy Markdown

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 6, 2026
@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

@haircommander @kannon92 @mrunalp Could you please help me to review this PR? Thanks

@haircommander

Copy link
Copy Markdown
Contributor

/lgtm

@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

@mrunalp Could you please help to review this PR? Thanks

@BhargaviGudi

Copy link
Copy Markdown
Contributor Author

The implementation PR (kubernetes/kubernetes#139277) has already been updated to use 128 as the minimum PID limit — all constants, validation, comments, and test cases reflect this change.

@harche harche left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against the implementation: the new bounds match both enforcement points, API validation (https://github.com/kubernetes/kubernetes/blob/f050421a6693073df402fde0cc9f3568087c2d1e/pkg/apis/core/validation/validation.go#L8279-L8280) and kubelet admission (https://github.com/kubernetes/kubernetes/blob/f050421a6693073df402fde0cc9f3568087c2d1e/pkg/kubelet/lifecycle/features_linux.go#L50-L51), and all five occurrences of 1024 in the doc are covered.

One sequencing note: this overlaps with #6258, both PRs delete the same Valid Values intro line and several lines touched here get the pid to pids rename there. Whichever merges second needs a rebase, and if this one goes second its reapplied lines should pick up the pids spelling.

Comment thread keps/sig-node/6063-pod-pid-limit/README.md Outdated
Comment thread keps/sig-node/6063-pod-pid-limit/README.md
@kubernetes-prow kubernetes-prow Bot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 27, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BhargaviGudi, mrunalp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2026
@harche

harche commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 27, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit a5c2cdd into kubernetes:master Jul 27, 2026
4 checks passed
@kubernetes-prow kubernetes-prow Bot added this to the v1.37 milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants