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

3

7

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

Reisch answered 10/10, 2020 at 16:49 Comment(4)
Based on your description of what works and what doesn't - my mind goes to the network plugin. If you installed the network plugin according to the guide you linked in your question, that's weave. Can you confirm that it's installed properly? kubectl get pods -n kube-system -o wideOffset
@TomKlino yes its installed properlly. I even tried installing sample wordpress app. and it worksReisch
the sample wordpress app in itself won't guarantee that your network plugin works. To check that, see that 2 pods working on 2 separate nodes can talk to each other (ping or telnet) - if they can't, that's a good direction to look at: security groups, firewalls or iptables that you didn't know were enabled, or weave configurations that you might have missed (never tried weave, so I wouldn't know where to point you if that's the issue)Offset
Hey @AMendis, Did you manage to solve it? What was the issue?Affecting
N
3

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.

Nostomania answered 28/10, 2020 at 6:13 Comment(0)
C
0

In case you are using kubectl proxy to connect to Kubernetes API, make sure kubeconfig file is properly configured. or try kubectl proxy --kubeconfig=/path/to/dashboard-user.kubeconfig

Note: This way of accessing Dashboard is only possible if you choose to install your user certificates in the browser. In example as mentioned before, certificates used by the kubeconfig file to contact API Server can be used.

Take a look: cannot-access-dashboard, kubernetes-dashboard-showing-http-proxy, accessing-dashboard-kubernetes, setting-kubernetes-dashboard.

Condescending answered 12/10, 2020 at 12:3 Comment(3)
Check if your kube-apiserver pod works properly. Check if kube-proxy pod is working. Can you please also execute localhost:8001/api/v1/namespaces/default/services/…>Condescending
yes kube-apiserver and kube-proxy services are working properly. I can access upto this link localhost:8001/api/v1/namespaces/kubernetes-dashboard/servicesReisch
Can you check kubectl -n kubernetes-dashboard get endpoints -o wide to get ip:port ? Try to reach it. You can also execute kubectl port-forward services/kubernetes-dashboard 8000:443 and then access kubernetes-dashboard with localhost:8000Condescending
V
0

This is a networking issue in your cluster. K8S Dashboard requires that in-cluster networking works properly and pods can reach apiserver through default kubernetes service.

Create i.e. a busybox pod and try to access apiserver through the service you'll get the same results.

Verla answered 3/4 at 12:40 Comment(1)
I think it would help to add code snippets to show how to create that busybox pod to verify what's wrong.Whip

© 2022 - 2024 — McMap. All rights reserved.