kubectl proxy unauthorized when accessing from another machine

2/7/2017

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?

-- Zeus82
kubectl
kubernetes
proxy

1 Answer

2/7/2017

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/

-- Janos Lenart
Source: StackOverflow