[root@k8s-master ~]#kubectl taint nodes k8s-node1 check1=yuanzhang1:NoExecute
node/k8s-node1 tainted
[root@k8s-master ~]#kubectl taint nodes k8s-node2 check2=yuanzhang2:NoExecute
node/k8s-node2 tainted
[root@k8s-master ~]#kubectl taint nodes k8s-node3 check3=yuanzhang3:NoExecute
node/k8s-node3 tainted
[root@k8s-master ~]#vim taint-tolerate-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: taint-tolerate-pod
spec:
containers:
- name: taint-tolerate
image: myapp-nginx:v1
imagePullPolicy: IfNotPresent
tolerations:
- key: "check1" #污点的key
operator: "Equal" #Equal等于value值
value: "yuanzhang1" #污点的value
effect: "NoExecute" #污点的effect
tolerationSeconds: 3600 #驱逐时继续保留运行的时间
[root@k8s-master ~]#kubectl apply -f taint-tolerate-pod.yaml
pod/taint-tolerate-pod created
[root@k8s-master ~]#kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
taint-tolerate-pod 1/1 Running 0 1s 10.244.1.16 k8s-node1 <none> <none>