I have Kubernetes running on a VM on my dev box. I want to view the Kubernetes dashboard from the VM host. When I run the following command:
kubectl proxy --address 0.0.0.0 --accept-hosts ^/.*
When I try to access the dashboard I get an unauthorized error.
What am I missing?
There is no way to stop it other than kill or ^C (if not in background).
The proxy provides a secure connection between the cluster(API Server) and the client, this avoid you having to change all your applications to implement a security logic just to communicate to the cluster, this way, you authenticate once, and every application use this secure connection without any changes.
Ans: In a terminal window, enter kubectl proxy to make the Kubernetes Dashboard available. Open a browser and go to http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes–dashboard:/proxy/#!/login to display the Kubernetes Dashboard that was deployed when the cluster was created.
Like the rest of Kubernetes control plane parts, the kube-proxy is instrumented with Prometheus metrics, exposed by default in the port 10249. This metrics endpoint can be easily scraped, obtaining useful information without the need for additional scripts or exporters.
The --accept-hosts access control is for checking of the hostname, so it won't start with a / (slash). You need to do:
kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
(Make sure you shell escape the .* as it may match files in the current directory!)
More information at: https://kubernetes.io/docs/user-guide/kubectl/kubectl_proxy/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With