post image :date_long | 1 min Read

taint and tolerations

taints are set to ‘‘Nodes’’

toleration are set to ‘‘PODS’’

taints:

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

Other ‘‘taint’’ options:

  • NoSchedule
  • PreferNoSchedule
  • NoExecute

Create a corresponding pod with tolerations

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

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

kubectl taint node  controlplane node-role.kubernetes.io/master:NoSchedule-node/controlplane untainted
author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus