3

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

returns

 Name:          basic-ingress
Namespace:      default
Address:        {hidden_external_ip}
Default backend:    nginx:80 ({hidden_internal_ip}:80)
Rules:
  Host  Path    Backends
  ----  ----    --------
  * *   nginx:80 ({hidden_internal_ip}:80)
Annotations:
  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
Events:
  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:

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<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>
<h2></h2>
</body></html>

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
6

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...)

3

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.

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.