Kubernetes Ingress (GCE) keeps returning 502 error

前端 未结 8 2029
一生所求
一生所求 2020-12-14 08:24

I am trying to setup an Ingress in GCE Kubernetes. But when I visit the IP address and path combination defined in the Ingress, I keep getting the following 502 error:

8条回答
  •  醉酒成梦
    2020-12-14 09:01

    Your backend k8s-be-32396--5fc40252fadea594 is showing as "UNHEALTHY".

    Ingress will not forward traffic if the backend is UNHEALTHY, this will result in the 502 error you are seeing.

    It will be being marked as UNHEALTHY becuase it is not passing it's health check, you can check the health check setting for k8s-be-32396--5fc40252fadea594 to see if they are appropriate for your pod, it may be polling an URI or port that is not returning a 200 response. You can find these setting under Compute Engine > Health Checks.

    If they are correct then there are many steps between your browser and the container that could be passing traffic incorrectly, you could try kubectl exec -it PODID -- bash (or ash if you are using Alpine) and then try curl-ing localhost to see if the container is responding as expected, if it is and the health checks are also configured correctly then this would narrow down the issue to likely be with your service, you could then try changing the service from a NodePort type to a LoadBalancer and see if hitting the service IP directly from your browser works.

提交回复
热议问题