<p>I'm trying to deploy a grafana instance inside Kubernetes (server 1.6.4) in GCE. I'm using the following manifests:</p>

<p><strong>Deployment</strong> (<a href="https://pastebin.com/HL5KqXtT" rel="nofollow noreferrer">full version</a>):</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: grafana
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: grafana
    spec:
      initContainers:
        …                                
      containers:
        - name: grafana
          image: grafana/grafana
          readinessProbe:
            httpGet:
              path: /login
              port: 3000
          …
</code></pre>

<p><strong>Service</strong>:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: grafana
spec:
  selector:
    name: grafana
  ports:
    - protocol: TCP
      port: 3000
  type: NodePort
</code></pre>

<p><strong>Ingress</strong>:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana
spec:
  tls:
    - secretName: grafana.example.com
  backend:
    serviceName: grafana
    servicePort: 3000
</code></pre>

<hr>

<p>It turns out that grafana serves a 302 on <code>/</code> but the default GCE ingress healthcheck expects a 200 on <code>/</code> (<a href="https://github.com/kubernetes/ingress-gce/blob/master/docs/faq/gce.md#why-does-the-ingress-need-a-different-instance-group-then-the-gke-cluster" rel="nofollow noreferrer">source</a>). As you can see, there is a custom <em>readinessProbe</em> in the <a href="https://pastebin.com/HL5KqXtT" rel="nofollow noreferrer">Deployment</a> (line 22).</p>

<p>Once I post these resources to the kube-apiserver, everything is created without error. Concretely, the <em>Ingress</em> gets a public ip4 address but <strong>the healtcheck is set up with the default <code>/</code> path instead of the custom one configured in the <code>readinessProbe</code></strong>. Because of this, I get a 502 if I <code>curl</code> the public ip4 address of the Ingress.</p>

<p>The problem is fixable by manually changing the probe path to <code>/login</code> in the GCE console.</p>

<p>Quoting from <a href="https://groups.google.com/g/kubernetes-users/c/lhVfyfCwEyo/m/b187gC84CwAJ" rel="nofollow noreferrer">here</a>:</p>

<blockquote>
  <p>The GLBC requires that you define the port (in your case 3000) within the Pod specification.</p>
</blockquote>

<p>The solution is to declare the port used for the healthcheck in <code>ports</code> besides adding a custom <code>readinessProbe</code>:</p>

<pre><code>containers:
  - name: grafana
    readinessProbe:
      httpGet:
        path: /login
        port: 3000
    ports:
      - name: grafana
        containerPort: 3000
    …
</code></pre>
