Exposing kibana with istio virtualservice need some extra steps

I have deployed elasticsearch and Kibana using the ECK operator as explained in

https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html

When I port-forward to Kibana service everything works fine. But if I expose the service using Istio virtualservice I see the login page only but nothing works even I cannot login to Kibana.

The problem is when Kibana runs behind a proxy there is some problem with the base path. By default Kibana base path is " /app/kibana". So in my Kibana manifest, I tried to set the basepath as environment variable as below

apiVersion: kibana.k8s.elastic.co/v1alpha1
kind: Kibana
metadata:
 name: my-kibana
 namespace: elastic-system
spec:
 version: 7.1.0
 nodeCount: 2
 elasticsearchRef:
   name: myelasticsearch
 podTemplate:
   metadata:
     labels:
       app: my-kibana
   spec:
     containers:
     - name: kibana
       resources:
         limits:
           memory: 1Gi
           cpu: 1
       env:
       - name: SERVER_BASEPATH
         value: /

But it seems the "SERVER_BASEPATH" env variable I tried to set in the pod template gets ignored by "Kibana" object.

My istio virtualservice is as below

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
 name: kibana
 namespace: elastic-system
spec:
 hosts:
 - "kibana.mydomain.com"
 gateways:
 - istio-system/https-gateway
 - istio-system/http-to-https-redirect
 http:
 #- match:
 #  - uri:
 #      prefix: "/app/kibana"
 #  rewrite:
 #    uri: "/"
 #  route:
 #    - destination:
 #        host: my-kibana
 #        port:
 #          number: 5601
 - route:
   - destination:
       host: my-kibana
       port:
         number: 5601

Any idea how to expose Kibana using istio when ECK operator is used?

NOTE: Please ignore any kind name mismatch as i put custom name here and Kibana works completely fine when I do kubectl portforward

Have you tried setting server.basePath in kibana.yml configuration? https://www.elastic.co/guide/en/kibana/current/settings.html

Thank you for your reply.
When I create a "Kibana" object, I am not sure how to pass a custom config file(kibana.yaml). I checked the kibana.yaml file though inside the pod. But if I manually update this file inside the pod this will not persist. That's why I was trying to set the "basepath" through environment variable in the kibana pod template. Unfortunately it seems they get ignored by the operator.

In ECK 0.8.x only a subset of podTemplate attributes are applied namely: labels, affinity and containers["kibana"].resources.limits

This is fixed in https://github.com/elastic/cloud-on-k8s/pull/952/

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.