Solution Taints And Tolerations
- How many nodes exist on the system:
kubectl get nodes - Do any
taintsexist?- Use
kubectl describe node <node_name>
- Use
- How to create a
taintonNode01:kubectl taint node node01 spray=mortein:NoSchedule - To check help, use
kubectl taint --helpand there are multiple examples there.- Key is
spray. Value ismorteinand the Effect isNoSchedule
- Key is
- Can then check the above under
Taintsfromkubectl describe ~ - Create a pod with
kubectl run <pod> --image=nginx - Cannot specify
TolerationImperatively in the command line. - Then we do the following to generate a yaml file for the pod:
kubectl run bee --image=nginx --dry-run=client -o yaml > bee.yaml - Then edit the
bee.yamlfile with these tolerations:tolerations: - key: spray value: mortein effect: NoSchedule operator: Equal - Then create the image:
kubectl create -f bee.yaml - Check for all pods and which nodes they are assigned to with
kubectl get pods -o wide - To remove a
taint:kubectl taint node controlplane node-role.kubernetes.io/master:NoSchedule-