How to see the rule, when error: didn't match pod anti-affinity rules

10.1k views Asked by At

I am getting - when installing Cilium:

Warning  FailedScheduling  4m21s (x17 over 84m)  default-scheduler  0/1 nodes are available: 1 node(s) didn't match pod anti-affinity rules. preemption: 0/1 nodes are available: 1 node(s) didn't match pod anti-affinity rules.

How can I see the rule and can I change it?

If I do kubectl describe node, id do not have anyy nodeAffinity settings. And the Node has Taints:<none>

1

There are 1 answers

0
Veera Nagireddy On

Run $ kubectl get pods , it shows Pending status. (kubectl get pods -o wide)

To describe the pod run $ kubectl describe pod POD_NAME, it shows a warning as part of events, if not works, try as suggested by @ Chris run kubectl get pod <name> -o yaml. There you'll find spec.affinity.

After identifying which anti-affinity rules triggers the warning. You can choose to

either rectify the rule or make some changes in the cluster to support the rule

For example : let's take a case, try to deploy 4 replicas of Ngnix deployment with podAntiAffinity rule in a 3 Node cluster. Here the last replica cannot be scheduled because no available Nodes left.

You can choose to reduce the number of replicas, increase the number of Nodes, adjust the rule to use soft/preference requirements or remove the podAntiAffinity rule.