I've tried following the following tutorial: https://cloud.google.com/container-engine/docs/tutorials/http-balancer

Everything seems to be working up until the end where doing

kubectl describe ingress basic-ingress


 Name:          basic-ingress
Namespace:      default
Address:        {hidden_external_ip}
Default backend:    nginx:80 ({hidden_internal_ip}:80)
  Host  Path    Backends
  ----  ----    --------
  * *   nginx:80 ({hidden_internal_ip}:80)
  backends:     {"k8s-be-00000--0000000000000000":"Unknown"}
  forwarding-rule:  k8s-fw-default-basic-ingress--0000000000000000
  target-proxy:     k8s-tp-default-basic-ingress--0000000000000000
  url-map:      k8s-um-default-basic-ingress--0000000000000000
  FirstSeen LastSeen    Count   From                SubobjectPath   Type        Reason  Message
  --------- --------    -----   ----                -------------   --    ------    ------  -------
  1m        1m      1   {loadbalancer-controller }          Normal          ADD default/basic-ingress
  23s       23s     1   {loadbalancer-controller }          Normal          CREATE  ip: {hidden_external_ip}

Notice that the backends line ends with "unknown"

Furthemore, curling the external IP returns this:

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>

Any idea what could cause such an issue?

  • did you figure out what was causing the issue? – anandaravindan Oct 27 '16 at 19:17
  • @anandaravindan Thanks for the reminder. Yes, I'll add an answer. – Nepoxx Oct 28 '16 at 15:41

I figured out two things:

  1. The load balancer does a health check on / (which is not documented AFAIK), so you have to make sure that your backend returns 200 on that path.

  2. There is a significant delay between when the load-balancer is created and when it "becomes active" (~10 minutes or so). When it does, the line: backends: {"k8s-be-00000--0000000000000000":"Unknown"} will become either: backends: {"k8s-be-00000--0000000000000000":"Healthy"} or backends: {"k8s-be-00000--0000000000000000":"Unhealthy"}. This delay was the reason the tutorial linked in the question was not working (it really should be documented there...)

| improve this answer | |

The "unknown" for the backend means that your backend is not Healthy, which is causing the 502 server error. Did you configure the health check to listen on the same port as the service running on the backend? Making the backend return Healthy should solve your issue. More information about debugging the health check can be found in this blog post.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.