Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing kubernetes dashboard gives Error trying to reach service: 'dial tcp 10.44.0.2:8443: connect: connection refused'

I used kubernetes hard way and managed to deploy a cluster successfully with kubernetes 1.18.6

I used vmware and kubernetes 1.18.6. I deployed metric-server and kubernets dashboard

I used this command --> kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='^*$' to startup kuberenetes dashboard

Then I used below url to access kubernes dashboard from my master node

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

But I'm getting below error in my browser

Error trying to reach service: 'dial tcp 10.44.0.2:8443: connect: connection refused'

But I can access kubernetes dashboard without any issue on my worker nodes using the url https://10.44.0.2:8443/

What am I missing ?

Why I can't access kubernetes dashboard normal way ?

I created another cluster with kubeadm tool and I can access kubernetes dashboard outside of the cluster.

I have weave and coredns configured and I don't see any errors on them. I did a smoke test and its all working properly. I even deployed wordpress and its also working properly.

All of my configurations are in https://github.com/godomainz/kubernetes-the-hard-way.git feature/Feature-1.18.6 branch

Guest OS : Ubuntu 18.04
Cluster environment used : VMWare workstation
Host PC: Windowd 10 Pro(i7 processor,64GB Ram)
Each VM has 15GB RAM with 8 Cores
Kubernetes version used : 1.18.6

like image 298
AMendis Avatar asked Oct 10 '20 16:10

AMendis


People also ask

What port does Kubernetes dashboard run on?

In the below code snippet, the Kubernetes dashboard service is listening on TCP port 443 and maps TCP port 8443 from port 443 to the dashboard pod port TCP/8443.

How do you expose Kubernetes dashboard?

Ans: In a terminal window, enter kubectl proxy to make the Kubernetes Dashboard available. Open a browser and go to http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes–dashboard:/proxy/#!/login to display the Kubernetes Dashboard that was deployed when the cluster was created.

Is Kubernetes dashboard deprecated?

Warning: The open source Kubernetes Dashboard addon is deprecated for clusters on GKE and will be removed as an option in version 1.15. As an alternative, use the Google Cloud console dashboards described in this guide.

What does Kubectl proxy do?

The proxy provides a secure connection between the cluster(API Server) and the client, this avoid you having to change all your applications to implement a security logic just to communicate to the cluster, this way, you authenticate once, and every application use this secure connection without any changes.


1 Answers

Try running the service on a different port

kubectl proxy --address='0.0.0.0' --port=8002 --accept-hosts='.*'

If this does not work then another Quick fix, edit the kubernetes-dashboard yaml file >> selector type is "ClusterIP" to "NodePort" if you are running on localhost.

like image 104
anurag Avatar answered Nov 15 '22 11:11

anurag