<p>I followed <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">this guide</a> to install the nginx ingress controller in the GKE.</p>
<p>Afterwards I followed <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">this guide</a> to create the ingress resource for my service.</p>
<p>I already setup my test app and service succesfully. Tested this by port-forwarding to the container.</p>
<p>Setting up the ingress seemed fine but I can't get access to it. When opening the <strong>external ip</strong> the following 502 error is print:</p>
<blockquote>
<p>Error: Server Error</p>
<p>The server encountered a temporary error and could
not complete your request.</p>
<p>Please try again in 30 seconds.</p>
</blockquote>
<p>Please see the <code>describe</code> of the ingress:</p>
<pre><code>│Name:         teamcity                                                                                                                           │
│Namespace:    default                                                                                                                            │
│Labels:       &lt;none&gt;                                                                                                                             │
│Annotations:  ingress.kubernetes.io/backends: {&quot;k8s-be-31984--b5c10175cf4f125b&quot;:&quot;UNHEALTHY&quot;}                                                     │
│              ingress.kubernetes.io/forwarding-rule: k8s-fw-default-teamcity--b5c10175cf4f125b                                                   │
│              ingress.kubernetes.io/target-proxy: k8s-tp-default-teamcity--b5c10175cf4f125b                                                      │
│              ingress.kubernetes.io/url-map: k8s-um-default-teamcity--b5c10175cf4f125b                                                           │
│              kubectl.kubernetes.io/last-applied-configuration:                                                                                  │
│                {&quot;apiVersion&quot;:&quot;extensions/v1beta1&quot;,&quot;kind&quot;:&quot;Ingress&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;teamcity&quot;,&quot;namespace&quot;:&quot;default&quot;},&quot;spec&quot;:│
│{&quot;backend...                                                                                                                                     │
│API Version:  extensions/v1beta1                                                                                                                 │
│Kind:         Ingress                                                                                                                            │
│Metadata:                                                                                                                                        │
│  Creation Timestamp:  2019-11-02T12:49:21Z                                                                                                      │
│  Generation:          1                                                                                                                         │
│  Resource Version:    553521                                                                                                                    │
│  Self Link:           /apis/extensions/v1beta1/namespaces/default/ingresses/teamcity                                                            │
│  UID:                 312aa230-fd6f-11e9-ad91-42010a84009d                                                                                      │
│Spec:                                                                                                                                            │
│  Backend:                                                                                                                                       │
│    Service Name:  teamcity                                                                                                                      │
│    Service Port:  8111                                                                                                                          │
│Status:                                                                                                                                          │
│  Load Balancer:                                                                                                                                 │
│    Ingress:                                                                                                                                     │
│      Ip:  35.190.86.15                                                                                                                          │
│Events:                                                                                                                                          │
│  Type    Reason  Age   From                     Message                                                                                         │
│  ----    ------  ----  ----                     -------                                                                                         │
│  Normal  ADD     18m   loadbalancer-controller  default/teamcity                                                                                │
│  Normal  CREATE  17m   loadbalancer-controller  ip: 35.190.86.15   
</code></pre>
<p>Additionally here is my yaml file for the whole mashup:</p>
<pre><code>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: teamcity
  labels:
    app: teamcity
spec:
  replicas: 1
  selector:
    matchLabels:
      app: teamcity
  template:
    metadata:
      labels:
        app: teamcity
    spec:
      containers:
      - name: teamcity-server
        image: jetbrains/teamcity-server:latest
        ports:
        - containerPort: 8111
---
apiVersion: v1
kind: Service
metadata:
  name: teamcity
  labels:
    app: teamcity
spec:
  type: NodePort
  ports:
  - port: 8111
    targetPort: 8111
    protocol: TCP
  selector:
    app: teamcity
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: teamcity
spec:
  backend:
    serviceName: teamcity
    servicePort: 8111
</code></pre>
<p>I'd like to know what I did wrong here.</p>

xetra11
<p>You are using GKE ingress controller with that Ingress resource, not Nginx. And the prove is that it is creating all the resources to create a HTTP load balancer; forwarding rule, target proxy, url map, backend service. </p>

<p>You need to pass the annotation <code>kubernetes.io/ingress.class: "nginx"</code> to your Ingress resource to let it know it shouod use Nginx Ingress Controller.</p>

<p>Now, you are getting 503 for while because GCP load balancers do not start working right away. Probably after about 3-4 minutes you will get 200.</p>
