0

I have a question related to openshift pod tolerations.

According to the document, tolerations are defined in pod. Spec not in deployment/deploymentconfigs

Here is the scenario, 3 master nodes with following taints, no other nodes

oc adm taint node master01 want=food:NoSchedule
oc adm taint node master02 want=drink:NoSchedule
oc adm taint node master03 want=money:NoSchedule

After deploying a simple hello-world app, not a surprise that pod stucks in pending state because pod doesn't have any tolerations

Name                   READY  STATUS     RESTARTS     AGE
hello-world-1-build    0/1    Pending    0            5s

Now add a toleration that tolerates all taints to hello-world-1-build

tolerations:
- operator: Exists

Now build is running but the application pod still in pending state, because I only added toleration to build pods.

After adding toleration to build pod

Adding the same tolerations to hello-world pod will change the state to running but if I want to scale to 10 pods, then I would have to manually add tolerations to all 10 pods.

Is there a better way, without removing the node taints?

Ask and Learn
  • 1,865
  • 4
  • 25
  • 34
  • I'm missing some information here: are all the pods started from the same Deployment? In that case, adding the tolerations to the Deployment should take care of all of them (after restarting the pods). – larsks Oct 18 '22 at 12:25
  • Yes, this is all from the same deployment and project. According to openshift document, tolerations are defined at `Pod` level. But I noticed project annotation can be used to add default tolerations to the project. I will try that – Ask and Learn Oct 18 '22 at 22:58
  • The documentation is telling you that tolerations are applied to *Pods*, rather than *Nodes* (it is contrasting them with taints). You use the `spec.template` section of your Deployment to define what your Pods will look like, so this is where you put things like tolerations or labels that you want to appear on the pods managed by the Deployment. – larsks Oct 18 '22 at 23:03
  • That worked, thanks. Have another question and hope you can help me. Is there a way to automatically create routes when the existing one is deleted? – Ask and Learn Oct 20 '22 at 21:11
  • I'm glad that worked out! With respect to your new question...you should [open a new question](https://unix.stackexchange.com/questions/ask) for that. – larsks Oct 20 '22 at 21:16
  • I did but because you provided a correct answer to this question so I just contacted you directly. If you want to submit an answer to this question I will accept. – Ask and Learn Oct 20 '22 at 21:23

0 Answers0