how to access local kubernetes minikube dashboard remotely

前端 未结 9 469
离开以前
离开以前 2021-01-30 14:46

Kubernetes newbie (or rather basic networking) question: Installed single node minikube (0.23 release) on a ubuntu box running in my lan (on IP address 192.168

相关标签:
9条回答
  • 2021-01-30 15:18

    Jeff Prouty added useful answer:

    I was able to get running with something as simple as:

    kubectl proxy --address='0.0.0.0' --disable-filter=true

    But for me it didn't worked initially.

    I run this command on the CentOS 7 machine with running kubectl (local IP: 192.168.0.20).

    When I tried to access dashboard from another computer (which was in LAN obviously):

    http://192.168.0.20:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/
    

    then only timeout was in my web browser.

    The solution for my case is that in CentOS 7 (and probably other distros) you need to open port 8001 in your OS firewall.

    So in my case I need to run in CentOS 7 terminal:

     sudo firewall-cmd --zone=public --add-port=8001/tcp --permanent
     sudo firewall-cmd --reload
    

    And after that. It works! :)

    Of course you need to be aware that this is not safe solution, because anybody have access to your dashbord now. But I think that for local lab testing it will be sufficient.

    In other linux distros, command for opening ports in firewall can be different. Please use google for that.

    0 讨论(0)
  • 2021-01-30 15:20

    The ssh way

    Assuming that you have ssh on your ubuntu box.

    First run kubectl proxy & to expose the dashboard on http://localhost:8001

    Then expose the dashboard using ssh's port forwarding, executing:

    ssh -R 30000:127.0.0.1:8001 $USER@192.168.0.20

    Now you should access the dashboard from your macbook in your LAN pointing the browser to http://192.168.0.20:30000

    To expose it from outside, just expose the port 30000 using no-ip.com, maybe change it to some standard port, like 80.

    Note that isn't the simplest solution but in some places would work without having superuser rights ;) You can automate the login after restarts of the ubuntu box using a init script and setting public key for connection.

    0 讨论(0)
  • 2021-01-30 15:24

    I reached this url with search keywords: minikube dashboard remote. In my case, minikube (and its dashboard) were running remotely and I wanted to access it securely from my laptop.

    [my laptop] --ssh--> [remote server with minikube]
    

    Following gmiretti's answer, my solution was local forwarding ssh tunnel:

    On minikube remote server, ran these:

    minikube dashboard
    kubectl proxy
    

    And on my laptop, ran these (keep localhost as is):

    ssh -L 12345:localhost:8001 myLogin@myRemoteServer
    

    The dashboard was then available at this url on my laptop:

    http://localhost:12345/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
    
    
    0 讨论(0)
提交回复
热议问题