kubectl create -f prod-deployment.yaml
kubectl get pods -o wide
Verify each pod has been scheduled and verify the toleration.
Use the following command to verify the pods have been scheduled:
kubectl get pods -o wide
Scale up the deployment:
We can see the prod pods will be deployed on node .102 or .103 where as the dev-pod would only ever be deployed on .103 because of the taint on node .102
kubectl scale deployment/prod --replicas=3
Verify the toleration of the production pod:
kubectl get pods $podName -o yaml | grep tolerations: -A12
I found the video didn't do a great job explaining what was happening but to show it's working, I made a new deployment and tried making pods until it crashed because the tainted node wouldn't accept them,
test.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- args:
- sleep
- "3600"
image: busybox
name: main
Use the following command to create the pod:
We can see the test pods won't get deployed on node .102 because unlike the prod code it doesn't have the toleration set to bypass the taint on the node.