'How to remotely access Kubernetes Dashboard

I am new to K8s. I have installed a Cluster on 2 Ubuntu VMs in a Cloud. Cluster is up and running. I have also installed the K8s Dashboard, and these are the services:

user@vm01:~$ kubectl get all -n kubernetes-dashboard
NAME                                             READY   STATUS    RESTARTS   AGE
pod/dashboard-metrics-scraper-799d786dbf-xjmbg   1/1     Running   0          121m
pod/kubernetes-dashboard-546cbc58cd-t68nn        1/1     Running   0          15m

NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
service/dashboard-metrics-scraper   ClusterIP   10.107.246.51    <none>        8000/TCP        121m
service/kubernetes-dashboard        **NodePort**    10.105.127.123   <none>        443:32000/TCP   121m

NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/dashboard-metrics-scraper   1/1     1            1           121m
deployment.apps/kubernetes-dashboard        1/1     1            1           121m

NAME                                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/dashboard-metrics-scraper-799d786dbf   1         1         1       121m
replicaset.apps/kubernetes-dashboard-546cbc58cd        1         1         1       15m
replicaset.apps/kubernetes-dashboard-fb8648fd9         0         0         0       121m

so the Dashboard service is NodePort. Then I start a proxy:

user@vm01:~$ kubectl proxy --address='0.0.0.0' --disable-filter=true
W0408 14:32:35.934866  206628 proxy.go:175] Request filter disabled, your proxy is vulnerable to XSRF attacks, please be cautious
Starting to serve on [::]:8001

Finally from my local Windows machine I open browser and type the URL:

http://*publicIP*:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

using the public IP of the VM.

Here what I get:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "services \"kubernetes-dashboard\" not found",
  "reason": "NotFound",
  "details": {
    "name": "kubernetes-dashboard",
    "kind": "services"
  },
  "code": 404
}

To me it looks that the proxy and the cluster are working but there is something wrong with Dashboard. So the questions are:

  1. is it possible to access K8s UI from remote as I am trying to do?
  2. how?

Any help appreciated. thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source