127.0.0.1:8001 refused to connect when kubectl proxy to access kubernetes dashboard
Asked Answered
A

2

11

I deploy a cluster (neo4j) with kubeadm based on this guide. Now I have these pods :

NAME           READY   STATUS    RESTARTS   AGE
neo4j-core-0   1/1     Running   0          20h
neo4j-core-1   1/1     Running   0          20h
neo4j-core-2   1/1     Running   0          20h

and these services :

NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP             60d
neo4j        ClusterIP   None             <none>        7474/TCP,6362/TCP   20h
nginx        ClusterIP   None             <none>        80/TCP              25h

Then I install kubernetes dashboard :

kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

So when I do kubectl proxy to access the dashboard, with below link, it says 127.0.0.1 refused to connect.

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

What should I do to access the dashboard?

I also create sample user following this guide.

Alasdair answered 9/12, 2018 at 11:24 Comment(0)
O
14

Kubernetes dashboard fully rely on Apiserver. Connection refused means there is an issue with communication with apiserver. Please see https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above#kubectl-proxy

Also you can try to run

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

And check if on other interface(port 8002) rather than 127.0.0.1 it works.

Ormuz answered 10/12, 2018 at 13:34 Comment(0)
A
1

Quick fix, edit the kubernetes-dashboard yaml file >> selector type is "ClusterIP" to "NodePort" if you are running on localhost. then visit "https://master_ip:exposed_port"

i think this helps.

Angelenaangeleno answered 20/1, 2019 at 20:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.