How do I setup ingress for Kibana in Kubernetes
Turns out the problem was with the kibana configuration.
In the kibana deployment yaml there is an environment variable called SERVER_BASEPATH
which is set to point at the kibana service proxy. This was causing the URL to be rewritten each time I tried to access the endpoint externally.
If you comment out this variable and it's value and redeploy kibana then it should work by just hitting the ingress address.
turns out following environment variables needs to be set in order to expose kibana through ingress:
add following in env in kibana deployment.yaml:
- name: ELASTICSEARCH_HOSTS value: "http://10.20.30.40:9200" - name: SERVER_BASEPATH value: "/kibana" - name: SERVER_REWRITEBASEPATH value: "true" - name: SERVER_PUBLICBASEURL value: "https://my.domain.com/kibana"
then use following to expose it over ingress:
apiVersion: networking.k8s.io/v1beta1kind: Ingressmetadata: namespace: elastic name: gateway-ingress annotations: kubernetes.io/ingress.class: nginxspec: rules: - host: my.domain.com http: paths: - path: /kibana backend: serviceName: kibana servicePort: 5601