Expose Kubernetes Dashboard to outside using Ingress return 404

2/22/2019

I would like to expose the dashboard to outside using Ingress. Below is my ingress configuration:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dashboard-ingress
  namespace: kube-system
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
   rules:
     - http:
          paths:
            - path: /dashboard
              backend:
                serviceName: kubernetes-dashboard
                servicePort: 80

And the kubernetes-dashboard service:

kubernetes-dashboard   ClusterIP   10.98.198.125   <none>        80/TCP    10d

Then when I access the outside, I got 404 page not found. What did I do wrong in the configuration?

-- Ock
kubernetes

1 Answer

3/1/2019

So I have investigated this, and it is a little bit tricky case.

I installed nginx with Helm Chart.

So first of all, my Ingress.yaml worked with only this two annotations:

nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/rewrite-target: /`

After that you will meet a new problem, which is dashboard will not work on /dashboard or any other path. It only works with path / even tho curl shows 200 and all seems to be fine - page still stays as blank.

Unfortunately I could not find a solution to that although I tried multiple configurations and workarounds. You can read more about it in this GitHub issue where there is a workaround - but unfortunately it did not work for me as well.

Hope I spared you some time on thinking why /dashboard does not work, even after the config is correct :)

-- aurelius
Source: StackOverflow