I want to use taint-based evictions in order to evict certain pods when
DiskPressure condition is true, but keep other pods running. As I understand from https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/, this can be achieved by adding disk-pressure tolerations to the pod, which I have done:
- effect: NoExecute key: node.kubernetes.io/disk-pressure operator: Exists
However, this seems to have no effect. If I disable kubelet evictions (removing certain settings from hard and soft evictions), disk pressure condition never happens, even when the disk is completely full. If I enable hard or soft eviction, pods get evicted, regardless of their tolerations.
I’ve inspected the taint manager code in the node lifecycle controller, and it seems that it only checks for
NoExecute taints. Kubelet will only taint the node with DiskPressure when kubelet eviction are enabled, and it will taint only with
NoSchedule, while it should be
Is this a bug or am I configuring something wrong?
Kubernetes version: v1.21.6 (latest master code seems to behave in the same way)
Cloud being used: bare-metal
Host OS: Debian