Kubernetes node taints
kubectl taint nodes 192.168.204.129 key1=value1:NoExecute
node/192.168.204.129 tainted
If you do not specify a key, you can use
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-hello-deployment3
namespace: lizhe
labels:
app: nginx-hello3
spec:
replicas: 6
selector:
matchLabels:
app: nginx-hello3
template:
metadata:
labels:
app: nginx-hello3
spec:
tolerations:
- effect: NoExecute
operator: Exists
containers:
- name: nginx-hello3
image: nginx
ports:
- containerPort: 80
All keys will be ignored
You can see nginx3 running on 129
If a specific key needs to be specified, for example, key = key2 is specified here. In fact, this key2 does not exist, so there is no tolerance
spec:
tolerations:
- effect: NoExecute
operator: Exists
key: key2
You can also add value, but you can’t use the operator
The Deployment "nginx-hello-deployment3" is invalid: spec.template.spec.tolerations[0].operator: Invalid value: core.Toleration{Key:"key1", Operator:"Exists", Value:"value2", Effect:"NoExecute", TolerationSeconds:(*int64)(nil)}: value must be empty when `operator` is 'Exists'
spec:
tolerations:
- effect: NoExecute
key: key1
value: value2
If you want to tolerate it
spec:
tolerations:
- effect: NoExecute
key: key1
value: value1