Unhealthy nodes for load balancer when using nginx ingress controller on GKE

江枫思渺然 提交于 2020-06-24 11:44:09

问题


I have set up the nginx ingress controller following this guide.

The ingress works well and I am able to visit the defaultbackend service and my own service as well.

But when reviewing the objects created in the Google Cloud Console, in particular the load balancer object which was created automatically, I noticed that the health check for the other nodes are failing:

Is this because the ingress controller process is only running on the one node, and so it's the only one that passes the health check? How do I make the other nodes pass?


回答1:


Your assumption is correct. The healthy node is indeed the one running the nginx pod.

The guide you're using configures the service with externalTrafficPolicy: Local.(https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/gce-gke/service.yaml)

That policy configures kube-proxy to never route traffic for a service off of the node where it arrives. So, when the load balancer traffic reached the nodes that have no nginx pod, the health check failed and the load balancer stopped sending traffic to them.

This configuration had the advantage of avoiding an extra network hop to get to the nginx pod. If you need more nodes to handle the traffic, you can ensure that there are nginx pods running there too. If you don't mind the extra network hop, you can change the externalTrafficPolicy too.



来源:https://stackoverflow.com/questions/48180990/unhealthy-nodes-for-load-balancer-when-using-nginx-ingress-controller-on-gke

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!