<p>I have elastic operator installed and running on my kubernetes cluster and I want to be able to access kibana through the <code>/kibana</code> subpath. I have an ingress that is configured like this:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-kb
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules: 
  - host: &quot;&quot;
    http:
      paths:
      - path: /kibana(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: kb-qs-kb-http
            port:
              number: 5601
</code></pre>
<p>What does the yaml file for my kibana instance have to look like, so that it is accessible through <code>/kibana</code> path?</p>

Cake
<p>Try this:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kibana-ingress
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
spec:
  rules:
    - host: &quot;localhost&quot; #OR YOUR HOST
      http:
        paths:
          - pathType: Prefix
            path: &quot;/kibana&quot;
            backend:
              service:
                name: kb-qs-kb-http
                port:
                  number: 5601
</code></pre>
<p>Also take a look at this link to have a clearer understanding of how the NGINX rewrite works:
<a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/examples/rewrite/</a></p>
