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.
Asked
Active
Viewed 176 times
0
-
did you try to expose the port to local with `kubectl proxy`? – BMW Jan 16 '20 at 04:35
-
I can access dashboard with nodePort 31117 locally. How to access dashboard outside the host with port 443? – Ethan Hu Jan 16 '20 at 05:02
-
1Please add tag Nginx. This question is more refers to Ngingx. You should find out how to map different andresses map to different PORTS. – TemaTre Jan 16 '20 at 05:20
1 Answers
2
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
- 10,007
- 2
- 25
- 41
-
Thank you for your solution. I have test it. The index.html can be load but the static resources included can not be loaded since they are using relative path which are mapping to the root. – Ethan Hu Jan 16 '20 at 07:25