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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,49 @@ will choose to evict pods of lowest Priority first.

If you are running a [static pod](/docs/concepts/workloads/pods/#static-pods)
and want to avoid having it evicted under resource pressure, set the
`priority` field for that Pod directly. Static pods do not support the
`priorityClassName` field.
`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.

>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.


>You must ensure that you account for resource use when defining static pods on existing nodes.
{{</ note >}}
For example, you might follow the following steps to set the `priorityClassName` for a static pod as `xyz-priority`.

```shell
kubectl get priorityclass
```

The output is similar to this:

```console
NAME VALUE GLOBAL-DEFAULT AGE
system-cluster-critical 2000000000 false 2m2s
system-node-critical 2000001000 false 2m2s
xyz-priority 1000000 false 47s
```

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

```yaml
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.

labels:
role: myrole
spec:
containers:
- name: web
image: nginx
ports:
- name: web
containerPort: 80
protocol: TCP
priorityClassName: xyz-priority
```

When the kubelet evicts pods in response to inode or process ID starvation, it uses
the Pods' relative priority to determine the eviction order, because inodes and PIDs have no
Expand Down