<p>Given the following K8s resources (deployment/pods, service, ingress), I expect to see the request echoed back to me when I visit <code>https://staging-micro.local/</code> in my browser. What I get instead is <code>502 Bad Gateway</code>. </p>

<pre><code># describe deployment (trunc. to show only containers)
Containers:
   cloudsql-proxy:
    Image:      gcr.io/cloudsql-docker/gce-proxy:1.11
    Port:       &lt;none&gt;
    Host Port:  &lt;none&gt;
    Command:
      /cloud_sql_proxy
      -instances=myproject:us-central1:project-staging=tcp:5432
      -credential_file=/secrets/cloudsql/credentials.json
    Environment:  &lt;none&gt;
    Mounts:
      /secrets/cloudsql from cloudsql-instance-credentials-volume (ro)
   adv-api-django:
    Image:      gcr.io/google_containers/echoserver:1.9
    Port:       8000/TCP
    Host Port:  0/TCP
    Environment:


# describe service
Name:                     staging-adv-api-service
Namespace:                staging
Labels:                   app=adv-api
                          platformRole=api
                          tier=backend
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"adv-api","platformRole":"api","tie...
Selector:                 app=adv-api-backend,platformRole=api,tier=backend
Type:                     LoadBalancer
IP:                       10.103.67.61
Port:                     http  80/TCP
TargetPort:               8000/TCP
NodePort:                 http  32689/TCP
Endpoints:                172.17.0.14:8000,172.17.0.6:8000,172.17.0.7:8000
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;


# describe ingress
Name:             staging-api-ingress
Namespace:        staging
Address:          10.0.2.15
Default backend:  default-http-backend:80 (172.17.0.12:8080)
Rules:
  Host                 Path  Backends
  ----                 ----  --------
  staging-micro.local  
                       /   staging-adv-api-service:http (172.17.0.14:8000,172.17.0.6:8000,172.17.0.7:8000)
</code></pre>

<p>note that I have the entry <code>192.168.99.100 staging-micro.local</code> in <code>/etc/hosts</code> on the host machine (running minikube) and that is the correct <code>minikube ip</code>. If I remove the service, hitting <code>staging-micro.local/</code> gives the <code>404 Not Found</code> response of the default backend. </p>

<p>My expectation is that the Ingress maps the hostname <code>staging-micro.local</code> and the path <code>/</code> to the service, which is listening on port 80. The service then forwards the request on to one of the 3 selected containers on port 8000. The echoserver container is listening on port 8000, and returns an HTTP Response with the Request as its body. This is, of course, not what actually happens.</p>

<p>Finally, the <code>cloudsql-proxy</code> container: this should not be involved at this point, but I'm including it because I wanted to validate the service works when the sidecar container is present. Then I can swap out the <code>echoserver</code> for my main application container. I have tested with <code>echoserver</code> removed, and get the same results. </p>

<p>Logs show the <code>echoserver</code> is starting up without error. </p>

<p>I haven't been able to locate any more comprehensive documentation of <code>echoserver</code> so I'm not 100% about the ports it's listening on. </p>

Ben
<p>My guess you have used wrong <code>echoserver:1.9</code> target container port, as it is responding on <code>8080</code> port by default. Look at this <a href="https://gist.github.com/kiloreux/4be1caec29f6a7f73e73f6a21e94a75b" rel="nofollow noreferrer">example</a>.</p>

<p>I have tested it on my environment with successful container responsiveness on <code>8080</code> port.</p>
