how to config basehref for kubernetes dashboard

1/16/2020

The k8s cluster is installed on a host which is only allowed requests through port 443 from external network. That means all the pods managed by k8s only can be reached through port 443. I installed a Nginx on the host to server reverse proxy to k8s cluster. I installed dashboard and other apps in k8s. The k8s dashboard is exposed with a nodePort 31117. How to config a basehref in k8s dashboard? For example https://ip/dashboard to open the k8s dashboard.

-- Ethan Hu
kubernetes
kubernetes-dashboard
nginx

1 Answer

1/16/2020

You need to set up an upstream in nginx. Since you have exposed it as NodePort -

location /dashboard/ {
proxy_pass https://<any-node-ip>:<dashboard-node-port>/;
}

You can also look at Ingress resource using which you can do the same without hosting your own nginx server.

-- Shashank V
Source: StackOverflow