How to access the canonical kubernetes dashboard from external network/IP? Is there a way to expose dashboard services externally rather accessing from the localhost browser where the canonical k8s cluster node?
相关问题
- Microk8s, MetalLB, ingress-nginx - How to route ex
- How do I change the storage class of existing pers
- Use awslogs with kubernetes 'natively'
- Why doesn't php sleep work in the windows-subs
- Installing Pydev for Eclipse throws error
相关文章
- k8s 访问Pod 时好时坏
- 为什么nfs在不同版本的Linux下安装的文件都不一样
- Override env values defined in container spec
- How do I create a persistent volume claim with Rea
- How to obtain the enable admission controller list
- Difference between API versions v2beta1 and v2beta
- Incompatible JavaHl library loaded
- MountVolume.SetUp failed for volume “nfs” : mount
The documentation has a guide on how to do it.
Using kubectl proxy
kubectl proxy
creates proxy server between your machine and Kubernetes API server. By default it is only accessible locally (from the machine that started it). Start local proxy server:Once proxy server is started you should be able to access Dashboard from your browser.
To access HTTPS endpoint of dashboard go to:
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
NOTE: Dashboard should not be exposed publicly using kubectl proxy command as it only allows HTTP connection. For domains other than localhost and 127.0.0.1 it will not be possible to sign in. Nothing will happen after clicking Sign in button on login page.
Using NodePort
This way of accessing Dashboard is only recommended for development environments in a single node setup. Edit
kubernetes-dashboard
service.You should see yaml representation of the service. Change type: ClusterIP to type: NodePort and save file. If it's already changed go to next step.
Next we need to check port on which Dashboard was exposed.
Dashboard has been exposed on port 31707 (HTTPS). Now you can access it from your browser at:
https://<master-ip>:31707
.master-ip
can be found by executingkubectl cluster-info
. Usually it is either 127.0.0.1 or IP of your machine, assuming that your cluster is running directly on the machine, on which these commands are executed.In case you are trying to expose Dashboard using NodePort on a multi-node cluster, then you have to find out IP of the node on which Dashboard is running to access it. Instead of accessing
https://<master-ip>:<nodePort>
you should accesshttps://<node-ip>:<nodePort>
.API Server
In case Kubernetes API server is exposed and accessible from outside you can directly access dashboard at:
https://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
Ingress
Dashboard can be also exposed using Ingress resource. For example
There are (at least) 2 ways of accessing the dashboard from the outside world:
1) running
kubectl proxy
in your development machine and visiting the address: http://localhost:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/#!/pod?namespace=default2) expose your dashboard service as you would do for any other service in your cluster, using a LoadBalancer, IngressController, NodePort or wathever other method.