I'm trying to set up an Ingress rule for a service (Kibana) running in my microk8s cluster but I'm having some problems.
The first rule set up is
Name: web-ingress
Namespace: default
Address: 127.0.0.1
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
k8s-ingress-tls terminates web10
Rules:
Host Path Backends
---- ---- --------
*
/ web-service:8080 (10.1.72.26:8080,10.1.72.27:8080)
Annotations: nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: false
Events: <none>
I'm trying to set Kibana service to get served on path /kibana
Name: kibana
Namespace: default
Address: 127.0.0.1
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
k8s-ingress-tls terminates web10
Rules:
Host Path Backends
---- ---- --------
*
/kibana(/|$)(.*) kibana:5601 (10.1.72.39:5601)
Annotations: nginx.ingress.kubernetes.io/ssl-redirect: false
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 17m nginx-ingress-controller Ingress default/kibana
Normal UPDATE 17m nginx-ingress-controller Ingress default/kibana
My problem is that first thing Kibana does is returns a 302 redirect to host/login?next=%2F which gets resolved by the first Ingress rule because now I've lost my /kibana path.
I tried adding nginx.ingress.kubernetes.io/rewrite-target: /kibana/$2
but redirect then just looks like host/login?next=%2Fkibana%2F
which is not what I want at all.
If I delete the first rule, I just get 404 once Kibana does a redirect to host/login?next=%2F
Add the following annotation to the kibana
ingress so that nginx-ingress interprets the /kibana(/|$)(.*)
path using regex:
nginx.ingress.kubernetes.io/use-regex: "true"
Additional detail:
To let kibana know that it runs on /kibana
path, add the following env variable to the kibana pod/deployment:
- name: SERVER_BASEPATH
value: /kibana