Kubernetes Taint and Toleration
Contents
You must know
Taint and Toleration
Usually it uses not to bind PODs to specific Node.
For example, there’s a Node that has GPU resources then you want not to bind PODs that don’t need GPU resources.
At this time, you can use taint and toleration.
For example, there’s a Node that has GPU resources then you want not to bind PODs that don’t need GPU resources.
At this time, you can use taint and toleration.
Taint
taint
taint
is to apply to the Node.Commands
Add taint command structure
|
|
Name | Example |
---|---|
[node-name] | node01 |
[key] | app |
[value] | myapp |
[taint-effect] | NoSchedule / PreferNoSchedule / NoExecute |
Add taint
|
|
Remove taint
|
|
Taint Effect
NoSchedule
If there’s no toleration in the PODSpec, the scheduler does not bind the POD to the Node.
It’s not affect to exist PODs.
It’s not affect to exist PODs.
PreferNoSchedule
If there’s no toleration in the PODSpec, the scheduler try not to bind the POD to the Node, but it’s not a necessary.
There’s not enough resources on the cluster, the scheduler could bind the POD to the Node that has taint.
There’s not enough resources on the cluster, the scheduler could bind the POD to the Node that has taint.
NoExecute
If there’s no toleration in the PODSpec, the scheduler does not bind the POD to the Node.
The exists PODs that don’t have toleration are terminated.
The exists PODs that don’t have toleration are terminated.
Toleration
tolerations
tolerations
is to set PODs.In the
tolerations
definitions, you need to set double quotes(") for the values.POD YAML
|
|
operator
operator
Equal
If the
operator
is Equal
, the value
must set same value of the taint
.Exists
If the
operator
is Exists
, you must not define the value
.When taint and tolerations matched
operator
= Equal
taint | tolerations |
---|---|
key | key |
value | value |
taint-effect | effect |
operator
= Exists
taint | tolerations |
---|---|
key | key |
taint-effect | effect |