kubectl proxy unauthorized when accessing from another machine
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/
In case someone stumbles upon this question and wants to restrict the access to the Host of the Guest VM.
I'm using VirtualBox, and I was able to allow access only from the Host machine by using localhost
and using SSH tunnel to the Guest VM
In Guest VM
$ kubectl proxy --address='0.0.0.0' --port=8002 --accept-hosts='localhost'
In Host machine I've added a hostname reference to static IP of the master plane kubemaster
$ echo "192.168.224.23 kubemaster" >> /etc/hosts$ ssh -N -L 8001:localhost:8002 kube@kubemaster
In Host, open your browser and navigate to
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/namespace?namespace=default