Nginx Ingress Controller can't find nodes on Google Kubernetes Engine

11/4/2019

I installed a "nginx ingress controller" on my GKE cluster. I followed this guide to install the nginx ingress controller in the GKE.

When deploying resources for the service and ingress resource I realized that the ingress controller was at 0/1 enter image description here

Events telling me:

0/1 nodes are available: 1 node(s) didn't match node selector.

Now I checked the yaml/describe: https://pastebin.com/QG3GKxh1 And found that:

nodeSelector:
    kubernetes.io/os: linux

Which looks fine in my opinion. Since I just used the command of the guide to install the controller I have no idea what went wrong from my side.

Solution:

The provided answer showed me the way. My node was labeled with beta.kubernetes/io: linux while the controller was looking for kubernetes/io: linux. Renaming the nodeSelector in the controller worked.

-- xetra11
google-kubernetes-engine
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

11/4/2019

nodeSelector is used to constraint the nodes on which your Pods can be scheduled.

With:

nodeSelector:
    kubernetes.io/os: linux

You are saying that Pods must be assigned to a node that has the label kubernetes.io/os: linux. If none of your nodes has that label, the Pod will never get scheduled.

Removing the selector from the nginx ingress controller or adding the label kubernetes.io/os: linux to any node should fix your issue.

-- Alassane Ndiaye
Source: StackOverflow