How can I get the kubectl proxy to the kubernetes dashboard working?

3k views Asked by At

I'm setting up a highly available microk8s cluster on three servers running ubuntu server 20.04. I enabled the dashboard addon and tried to forward it using the command

kubectl port-forward -n kube-system service/kubernetes-dashboard 10443:443

in WSL Ubuntu with the microk8s cluster configured in the kubeconfig file, but it returned the error

error: error upgrading connection: error dialing backend: dial tcp 192.168.250.235:10250: connect: no route to host

so then I tried running microk8s dashboard-proxy on one of the servers to see if that would work, and it returned the error

Checking if Dashboard is running.
Dashboard will be available at https://127.0.0.1:10443
Use the following token to login:
<TOKEN>
error: error upgrading connection: error dialing backend: dial tcp 192.168.250.235:10250: connect: no route to host
Traceback (most recent call last):
  File "/snap/microk8s/1710/scripts/wrappers/dashboard-proxy.py", line 80, in <module>
    dashboard_proxy()
  File "/snap/microk8s/1710/scripts/wrappers/dashboard-proxy.py", line 74, in dashboard_proxy
    check_output(command)
  File "/snap/microk8s/1710/usr/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/snap/microk8s/1710/usr/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/snap/microk8s/current/microk8s-kubectl.wrapper', 'port-forward', '-n', 'kube-system', 'service/kubernetes-dashboard', '10443:443', '--address', '0.0.0.0']' returned non-zero exit status 1

The addons dashboard, dns, ha-cluster, helm3 and metrics-server are enabled in the microk8s cluster.

kubectl get nodes returns the following output:

NAME    STATUS   ROLES    AGE    VERSION
esx02   Ready    <none>   93m    v1.19.2-34+1b3fa60b402c1c
esx03   Ready    <none>   87m    v1.19.2-34+1b3fa60b402c1c
esx01   Ready    <none>   101m   v1.19.2-34+1b3fa60b402c1c

esx01 has the ip 192.168.250.51, esx02 the IP 192.168.250.52 and esx03 the IP 192.168.250.53.

the output of kubectl -n kube-system describe service/kubernetes-dashboard is:

Name:              kubernetes-dashboard
Namespace:         kube-system
Labels:            k8s-app=kubernetes-dashboard
Annotations:       <none>
Selector:          k8s-app=kubernetes-dashboard
Type:              ClusterIP
IP:                10.152.183.174
Port:              <unset>  443/TCP
TargetPort:        8443/TCP
Endpoints:         10.1.40.194:8443
Session Affinity:  None
Events:            <none>
0

There are 0 answers