dockerkubernetesminikube

How to configure external IP address of minikube dashboard?


I use docker desktop and minikube on Windows 10. I found the ip address of local docker repository with minikube docker-env command like below,

> minikube docker-env
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://172.17.105.232:2376
SET DOCKER_CERT_PATH=C:\Users\joseph\.minikube\certs
SET MINIKUBE_ACTIVE_DOCKERD=minikube
REM To point your shell to minikube's docker-daemon, run:
REM @FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env') DO @%i

And I set the ip address of docker daemon with above DOCKER_HOST value, not localhost and I can use locally built docker images without errors. But in the case of minikube dashboard, the ip address is always localhost(127.0.0.1) when I type minikube dashboard command. So I can not generate kubernetes namespace and persistent volume. It throws error

the server could not find the requested resource

I think this issue is the matter of authorization with different ip addresses. How to configure the static or specific ip address and port number on minukube dashboard so I can generate namespace and persistent volumes without such errors on minikube dashboard?


Solution

  • If I understand correctly you are trying to access kubernetes dashboard from remote host. When running minikube dashboard, minikube binary runs kubectl proxy command under the hood.

    By default running kubectl proxy binds to loopback interface of your local machine, therefore it can't be accessed from outside.

    You can't change minikube cli bahaviour (without changing source code) but what you can do is to note down path to a dashboard:

    /api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
    

    and run kubectl proxy by your self adding --address paramater with 0.0.0.0 value.

    So now running this you will see:

    $ kubectl proxy --address 0.0.0.0
    Starting to serve on [::]:8001
    

    Now open a browser on your remote host and go to:

    <your-host-external-ip>:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
    

    That's it. Let me know if it helped.