Post

taint and tolerations

taint and tolerations

taint and tolerations

taints are set to ‘‘Nodes’’

toleration are set to ‘‘PODS’’

taints:

1
2
kubectl taint nodes arch app=blue:NoSchedule
node/arch tainted

Other ‘‘taint’’ options:

  • NoSchedule
  • PreferNoSchedule
  • NoExecute

Create a corresponding pod with tolerations

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx-controller
  name: nginx-controller
spec:
  containers:
  - image: nginx
    name: nginx-controller
  tolerations:
  - effect: NoSchedule
    key: app
    operator: Equal
    value: blue

practice

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
kubectl taint node node01 spray=mortein:NoSchedule
node/node01 tainted

 cat bee.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: bee
  name: bee
spec:
  containers:
  - image: nginx
    name: bee
  tolerations:
  - effect: "NoSchedule"
    key: "spray"
    value: "mortein"
    operator: "Equal"

untaint controlplane in katacoda

1
kubectl taint node  controlplane node-role.kubernetes.io/master:NoSchedule-node/controlplane untainted
This post is licensed under CC BY 4.0 by the author.