Evaluate affinity rules

4/17/2019

I updated a statefulset deployment and the deleted pods of that statefulset are pending forever. Thus I described the pods and saw that they can not be scheduled on nodes because the nodes didn't match the pod affinity/anti-affinity rules. This statefulset however has no affinity rules at all.

My question

How can I evaluate the affinity rules of my statefulset, so that I can see what affinity rules are hindering these pods from starting?

I believe it must be a different deployment which hinders these pods from starting up, but I am clueless which deployment it might be.

-- kentor
kubernetes

2 Answers

4/17/2019

Statefulsets pods might be preventing the deletion because you may have some pv-protection, the best way to troubleshoot that situation is running kubectl get events -n ${yournamespace}, any event on your namespace will be listed.

Try to see if any warning or error message is displayed.

NOTE: If you get too many events, try to filter using --field-selector=type!=Normal,reason!=Unhealthy

-- gonzalesraul
Source: StackOverflow

4/17/2019

check this in order to determine the possible root cause

  • check if your nodes have taints (kubectl describe node {Node_Name} | grep Taint), if it is the case look for tolerations in order to schedule a workload in a specific node.

  • you have in the definition the field nodeName and is being pointed to an no existing node.

  • as Prateek Jain recommended above check your pod with describe in order to see what exactly is being overriden in your definition.

-- cperez08
Source: StackOverflow