0

I have installed and configure Kubernates in my Ubuntu virtual machine

Reference: Document Link

Started kubernetes proxy using below command

kubectl proxy --address='0.0.0.0'

I'm able to access my dashboard using http://localhost:8001 link on localhost when I'm trying to access the dashboard from outside using http://192.168.33.30:8001/ link getting following Error

<h3>Unauthorized</h3>

Can anyone help me on this?

mohan08p
  • 5,002
  • 1
  • 28
  • 36
Ashwani
  • 485
  • 2
  • 9
  • 23
  • Hi. Have you tried this?:kubectl proxy --address='localhost' --accept-hosts='^.*$' --port=8001 – saromba Sep 04 '18 at 07:15
  • Thanks for the quick response, It works using Command: `kubectl proxy --address='0.0.0.0' --accept-hosts='^.*$' --port=8001` and I'm able to access kubernetes dashboard from outside but not able to login using provided token – Ashwani Sep 04 '18 at 10:38

1 Answers1

2

It works using below command:

kubectl proxy --address='0.0.0.0' --accept-hosts='^.*$' --port=8001

After this, I am able to access the Kubernetes dashboard outside using VM IP address

Ashwani
  • 485
  • 2
  • 9
  • 23
  • Can you please explain this solution.Why simply kubectl proxy doesn't work.Every online document only mentions about that only. – Ratish Bansal Nov 28 '19 at 14:23
  • I am a bit late to answer Ratish Bansal but I found this page with this problem. Ashwani has a great solution which worked for me, but I also wanted to understand what it means. The docs are here https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#proxy The key here is --accept-hosts='^.*$' which is a regular expression indicating which hosts can access this endpoint. Using Ashwani's solution will allow anybody who can reach that endpoint to access the data there. You probably want to change this if you need a secure application. – MarkA Oct 26 '20 at 18:54
  • For anyone still having the problem; issue the same command with sudo. It will help you access the dashboard outside VM. – Deepak Apr 05 '21 at 19:03