kuberneteskubernetes-dashboard

Kubernetes Dashboard is not available


This is my first time what I'm installing Kubernetes and trying to understand how it works. First problem that I can't solve is opening Dashboard via HTTP protocol using proxy by visting the URL from documentation:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Browser's respond is: This site can’t be reached. Localhost refused to connect.


Little bit about my environment!

I've started with virtual machines equipped with:

  1. Master: 2 VCPU, 4GB RAM, Ubuntu 18.04
  2. Worker1: 1 VCPU, 2GB RAM, Ubuntu 18.04
  3. Worker1: 1 VCPU, 2GB RAM, Ubuntu 18.04

All running and connected to a private network.

So far I followed the instructions to setup production environment by installing kubeadm. Than created a single control-plane cluster with kubeadm without joining any nodes yet.

Environment that I created is:


All seems to be running.

installing kubernetes dashboard

What I can is to see some respond when I load

https://master-IP:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

installing kubernetes dashboard

So what I can't is to open/load Kubernetes Dashboard UI using proxy over HTTP protocol by official Kubernetes Dashboard documentation.


P.S. One thing is unclear to me when setting up a new user to log in to Dashboard using bearer token tied to this user. Shouldn't the value of namespace be changed from kube-system to kubernetes-dashboard according to the changelog of v2.0.0-beta1?


Solution

  • I see that you would like to access the dashboard from your laptop. What you should do is create an admin account called k8s-admin:

    $ kubectl --namespace kube-system create serviceaccount k8s-admin
    $ kubectl create clusterrolebinding k8s-admin --serviceaccount=kube-system:k8s-admin --clusterrole=cluster-admin
    

    Then setup kubectl on your laptop / workstation: For example for macOS it looks like this (see documentation):

    $ brew install kubernetes-cli
    

    Setup a proxy to your workstation. Create a ~/.kube directory on your laptop and then scp the ~/.kube/config file from the k8s (Kubernetes) master to your ~/.kube directory.

    Then get the authentication token you need to connect to the dashboard:

    $ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep k8s-admin | awk '{print $1}')
    

    Store this token, you’ll need it to access the Kubernetes dashboard. Now start the proxy:

    $ kubectl proxy
    

    Now open the dashboard by going to:

    http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
    

    You should see the Token option and then copy-paste the token from the prior step and Sign-In.

    You can follow this tutorial.