Skip to content

Explain that static Pods never get evicted under node pressure #50569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jayeshmahajan
Copy link
Contributor

Description

Update README: Add priorityClassName usage for static Pods
This PR enhances the README with an example and explanation of how to assign priorityClassName to static Pods.

📌 Includes a note clarifying how kubelet treats static Pods with respect to priority.

✅ Adds sample output of kubectl get priorityclass.

📝 Demonstrates a complete static Pod definition using priorityClassName: xyz-priority.

This addition improves understanding of static Pod scheduling behavior and resource management.

Issue

kubernetes/kubernetes#126542

Closes: # kubernetes/kubernetes#126542

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2025
@k8s-ci-robot k8s-ci-robot added the language/en Issues or PRs related to English language label Apr 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dipesh-rawat for approval. For more information see the Code Review Process.

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

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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 21, 2025
Copy link

netlify bot commented Apr 21, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit cf457bc
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/682d2360bcf2710008d5a59e
😎 Deploy Preview https://deploy-preview-50569--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

`priorityClassName` field for that Pod directly.

**Note:**
>The kubelet considers all static pods as critical regardless of their `.spec.priorityClassName`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about this?
My take is that static Pods can be evicted as just other Pods. They will never get admitted unless the kubelet is restarted.

Copy link
Contributor Author

@jayeshmahajan jayeshmahajan May 21, 2025

Choose a reason for hiding this comment

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

apiVersion: v1
kind: Pod
metadata:
name: static-web
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting usage scenario ...
you are running a static Pod as web server?

Static pods are created by the kubelet, even when the kubelet doesn't know a thing about the API server. In this case, how does the kubelet handle things like priority class (e.g. priorityClassName)?

Copy link
Contributor

Choose a reason for hiding this comment

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

The kubelet creates mirror Pods and responds to (externally managed) static pod manifests.

But yes, I can't see how a static Pod can usefully have a priorityClassName.

@lmktfy
Copy link
Contributor

lmktfy commented Apr 21, 2025

/retitle Explain that static Pods never get evicted under node pressure

@k8s-ci-robot k8s-ci-robot changed the title [doc] Static Pods never get evicted when under Node Pressure #126542 Explain that static Pods never get evicted under node pressure Apr 21, 2025
@lmktfy
Copy link
Contributor

lmktfy commented Apr 21, 2025

We avoid mentioning issues in commit messages

`priorityClassName` field.
`priorityClassName` field for that Pod directly.

**Note:**
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a special short code for note callouts; please use that.

See https://kubernetes.io/docs/contribute/style/style-guide/#note

xyz-priority 1000000 false 47s
```

This is a definition for a static Pod. You would define this directly for the kubelet on a particular nod (and not via kubectl)
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: nod

apiVersion: v1
kind: Pod
metadata:
name: static-web
Copy link
Contributor

Choose a reason for hiding this comment

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

The kubelet creates mirror Pods and responds to (externally managed) static pod manifests.

But yes, I can't see how a static Pod can usefully have a priorityClassName.

**Note:**
>The kubelet considers all static pods as critical regardless of their `.spec.priorityClassName`.
>Static pods also pass kubelet admission even if a node does not have enough resources; the kubelet may
>instead evict another Pod (potentially even evicting a different Pod at a higher priority, if there is no better match).
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give an example of the kubelet evicting a higher-priority, non static Pod? It will help folks decide whether to accept the changes in this PR.

@jayeshmahajan jayeshmahajan requested review from tengqm and lmktfy May 21, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants