Search code examples
macoskuberneteskind

preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling


On Mac with kind, I created a single node cluster, and then try to install nginx ingress as instructed in https://kind.sigs.k8s.io/docs/user/ingress/

kind create cluster --name devops

kubectl apply --filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml

kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=180s

it times out; and for the node, there is no taint

kubectl get node
NAME                   STATUS   ROLES           AGE   VERSION
devops-control-plane   Ready    control-plane   16m   v1.25.2

kubectl describe node devops-control-plane | grep Taint
Taints:             <none>

the time out is due to failure to place pod on the master node

kubectl -n ingress-nginx describe pod ingress-nginx-controller-7d68cdddd8-tkzzz
...
Node-Selectors:              ingress-ready=true
                             kubernetes.io/os=linux
Tolerations:                 node-role.kubernetes.io/control-plane:NoSchedule
                             node-role.kubernetes.io/master:NoSchedule
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  104s  default-scheduler  0/1 nodes are available: 1 node(s) didn't match Pod's node affinity/selector. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.

what did I do wrong here?


Solution

  • Please read the documentation about assigning Pods to nodes! I see you have some node selectors on your pod. This is probably the cause of the scheduling failure. You can either remove the node selectors or add the required labels to your node (I am guessing the ingress-ready label is missing):

    kubectl label nodes devops-control-plane ingress-ready=true