<p>I created an ingress on GKE for kibana, and the browser returns 404 (although it works with the original service), and I guess it's because I need to route to the <code>/app/kibana</code> endpoint. How can I do that?</p>
<p>This is my ingress:</p>
<pre><code>kind: Ingress
metadata:
  name: my-ingress
  namespace: default
  annotations:
    ingress.kubernetes.io/affinity: cookie
    kubernetes.io/ingress.class: gce
    kubernetes.io/ingress.global-static-ip-name: my-proxy
    ingress.kubernetes.io/affinity: cookie
    ingress.kubernetes.io/session-cookie-hash: sha1
    ingress.kubernetes.io/session-cookie-name: route
    nginx.ingress.kubernetes.io/affinity: cookie
    kubernetes.io/ingress.class: gce
    kubernetes.io/ingress.allow-http: &quot;false&quot;
  annotations:
spec:
  tls:
  - secretName: my-tls
  rules:
  - http:
      paths:
      - path: /kibana
        backend:
          serviceName: kibana-nodeport
          servicePort: 5601 
</code></pre>
<p>my nodeport service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: kibana-nodeport
  namespace: default
spec:
  ports:
  - port: 5601
    protocol: TCP
    targetPort: 5601
  selector:
    k8s-app: kibana
  sessionAffinity: None
  type: NodePort
</code></pre>
<p>the kibana orginial service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    component: kibana
  name: kibana-ext
  namespace: default
spec:
  externalTrafficPolicy: Cluster
  loadBalancerSourceRanges:
    - x.x.x.x/32
  ports:
  - name: http
    port: 5601
    protocol: TCP
    targetPort: 5601
  selector:
    k8s-app: kibana
  sessionAffinity: None
  type: LoadBalancer
</code></pre>
<p><strong>UPDATE:</strong></p>
<p>When I set Kibana's path to &quot;/*&quot;, it works. Otherwise I get 404.</p>

Idan
<p>As the original issue was resolved by an answer provided by user @paltaa and fixed by original poster:</p>
<blockquote>
<p>I changed the kibana.yml to be rewritten to /kibana plus changing to your suggestion and it worked! thanks – Idan</p>
</blockquote>
<p>I wanted to add some additional resources/information and a &quot;guide&quot; that could help when dealing with similar issues.</p>
<hr />
<p>Steps to run Kibana in <code>GKE</code> with <code>ingress-gke</code>:</p>
<blockquote>
<p>Please remember that this is a basic setup for example purposes only.</p>
</blockquote>
<ul>
<li>Provision the resources with Helm</li>
<li>Create an <code>Ingress</code> resource</li>
<li>Change the Healthcheck in GCP Cloud Console (Web UI)</li>
<li>Test</li>
</ul>
<hr />
<h3>Provision the resources with Helm</h3>
<p>I used below Github page for a reference when installing:</p>
<ul>
<li><em><a href="https://github.com/elastic/helm-charts/tree/master/kibana" rel="nofollow noreferrer">Github.com: Elastic: Helm-charts: Kibana</a></em></li>
</ul>
<blockquote>
<p>Method of spawning this setup could be different but the principles should be the same (values).</p>
</blockquote>
<p>Commands used (specific to Helm3):</p>
<ul>
<li><code>$ helm repo add elastic https://helm.elastic.co</code></li>
<li><code>$ helm install es elastic/elasticsearch</code></li>
<li><code>$ helm pull elastic/kibana --untar</code></li>
<li><code>$ cd kibana/ &amp;&amp; nano values.yaml</code></li>
</ul>
<p>The changes made in the <code>values.yaml</code> are following:</p>
<pre class="lang-sh prettyprint-override"><code>healthCheckPath: &quot;/test/app/kibana&quot;
</code></pre>
<pre class="lang-sh prettyprint-override"><code># Allows you to add any config files in /usr/share/kibana/config/
# such as kibana.yml
# Will work with http://DOMAIN.NAME/test/
kibanaConfig:
   kibana.yml: |
       server.basePath: /test
       server.rewriteBasePath: true
</code></pre>
<pre class="lang-sh prettyprint-override"><code>service:
  type: NodePort # &lt;-- Changed from ClusterIP for ingress-gke
  loadBalancerIP: &quot;&quot;
  port: 5601
  nodePort: &quot;&quot;
  labels: {}
  annotations: {}
</code></pre>
<ul>
<li><code>$ helm install ki .</code></li>
</ul>
<hr />
<h3>Create an <code>Ingress</code> resource</h3>
<p>I used this <code>Ingress</code> resource to have an access to the Kibana:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana-ingress
spec:
  tls:
  - secretName: ssl-certificate
  rules:
  - host: DOMAIN.NAME
    http:
      paths:
      - path: /test/*
        backend:
          serviceName: ki-kibana
          servicePort: 5601
</code></pre>
<p><strong>As for the annotations used in the question, please review them as some of them could be specific to <code>ingress-nginx</code> and will not work with <code>ingress-gke</code>.</strong></p>
<hr />
<p>After applying this resource I couldn't connect to Kibana because of the path of a Healthcheck created:</p>
<ul>
<li>Healthcheck created path (incorrect): <code>/</code></li>
<li>Healthcheck changed path (correct): <code>/test/app/kibana</code></li>
</ul>
<p>You can change the Healthcheck by following:</p>
<ul>
<li><code>GCP Cloud Console (Web UI)</code> --&gt; <code>Kubernetes Engine</code> --&gt; <code>Services &amp; Ingress</code> --&gt; <code>kibana-ingress</code> --&gt; <code>backend services (unhealthy)</code> --&gt; <code>Health Check</code> --&gt; <code>Edit</code></li>
</ul>
<p><a href="https://i.stack.imgur.com/Woy6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Woy6v.png" alt="Healthcheck" /></a></p>
<hr />
<h3>Test</h3>
<p>After all of above steps you can open a web browser and enter:</p>
<ul>
<li><code>https://DOMAIN.NAME/test</code></li>
</ul>
<p>and be greeted by Elastic's Web UI.</p>
<hr />
<p>Additional resources:</p>
<ul>
<li><em><a href="https://cloud.google.com/load-balancing/docs/health-check-concepts" rel="nofollow noreferrer">Cloud.google.com: Load-balancing: Docs: Healthcheck concepts</a></em></li>
<li><em><a href="https://logz.io/blog/deploying-the-elk-stack-on-kubernetes-with-helm/" rel="nofollow noreferrer">Logz.io: Blog: Deploying the ELK stack on Kubernetes with Helm</a></em></li>
<li><em><a href="https://www.elastic.co/guide/en/kibana/master/settings.html" rel="nofollow noreferrer">Elastic.co: Guide: Kibana: Master: Settings</a></em></li>
</ul>
