1

I followed How can I access to kubernetes dashboard using NodePort in a remote cluster for testing?

My Kubernetes cluster runs in Amazon EC2 instances and cluster services looks like below

$ kubectl get services --all-namespaces
NAMESPACE     NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
default       kubernetes             ClusterIP   100.64.0.1      <none>        443/TCP         5h54m
kube-system   kube-dns               ClusterIP   100.64.0.10     <none>        53/UDP,53/TCP   5h53m
kube-system   kubernetes-dashboard   NodePort    100.68.178.51   <none>        443:31872/TCP   5h47m

$ kubectl cluster-info
Kubernetes master is running at https://api.selumalai.k8s.com
KubeDNS is running at https://api.selumalai.k8s.com/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

I have exposed the NodePort at 31872. If I access the dashboard in browser using

$ kubectl  proxy -p 8001 &
$ curl https://api.selumalai.k8s.com:31872

Its loading forever. What am I doing wrong ?

saranya elumalai
  • 429
  • 2
  • 5
  • 14
  • 1. Why are you running `kubectl proxy -p 8001 &`? 2. Make sure your firewall rules allow external traffic. – dmkvl Apr 24 '20 at 22:43

1 Answers1

0

You need to add a security group to your instance to allow traffic for port 31872.

It's explained how to do so here.

If you use kubectl proxy it can be accessed localy only, which is stated in the docs:

...

kubectl proxy

... The UI can only be accessed from the machine where the command is executed. See kubectl proxy --help for more options.

Also here is a guide from AWS on how to Deploy the Kubernetes Dashboard (web UI). You can try running a L7 ELB to expose the Dashboard which is explained here.

Crou
  • 10,232
  • 2
  • 26
  • 31
  • I added the nodeport 31872 to the security group. I can access dashboard via curl inside aws ec2 cluster but not outside (in my local machine browser). Should I need to enable something else ? – saranya elumalai Apr 27 '20 at 18:42
  • Try pining your cluster from the outside. How many nodes does your cluster have? Can You post output of `kubectl get nodes -owide` – Crou Apr 28 '20 at 11:29