0

I have kubernetes-dashboard service with type is ClusterIP. How can I access dashboard internal? I use Alibaba Cloud.

My service.yml

---
kind: Service
apiVersion: v1
metadata:
  labels:
    kubernetes.io/cluster-service: "true"
    app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: 9090
  selector:
    app: kubernetes-dashboard

I would like to run my dashboard at http://MASTER_IP:80

The status when running kubectl cluster-info:

Kubernetes master is running at https://MASTER_IP:6443
Heapster is running at https://MASTER_IP:6443/api/v1/namespaces/kube-system/services/heapster/proxy
KubeDNS is running at https://MASTER_IP:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
kubernetes-dashboard is running at https://MASTER_IP:6443/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy
monitoring-influxdb is running at https://MASTER_IP:6443/api/v1/namespaces/kube-system/services/monitoring-influxdb/proxy

When I access https://MASTER_IP:6443, I got the error default backend - 404.

Note: Don't use NodePort and kubectl proxy.

Many thanks.

Huy Chau
  • 2,178
  • 19
  • 26

2 Answers2

0

Change the dashboard service type to NodePort then you can access dashboard with any cluster :

  1. change service type from ClusterIP to NodePort kubectl -n kube-system edit svc kubernetes-dashboard

  2. Get the service port number.

    kubectl -n kube-system get svc kubernetes-dashboard -o yaml |grep nodePort

  3. Access dahboard with https://masererverIP:nodeportnumber

sfgroups
  • 18,151
  • 28
  • 132
  • 204
0

In this answer you can find the different ways to access the dashboard.

If you are not using NodePort or kubectl proxy, your best options are

API Server

In case Kubernetes API server is exposed and accessible from outside you can directly access dashboard at: https://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Ingress

Dashboard can be also exposed using Ingress resource. For example

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: kubernetes-dashboard-ingress
 namespace: kube-system
spec:
 rules:
   — host: kubernetes
     http:
       paths:
         — path: /ui
           backend:
             serviceName: kubernetes-dashboard
             servicePort: 80
Community
  • 1
  • 1
Jose Armesto
  • 12,794
  • 8
  • 51
  • 56
  • Thanks @fiunchinho, I try to add Ingress to my cluster, but it's not working. Please help me more about it. About API server, how to get port? – Huy Chau Jan 18 '18 at 07:08
  • This blog post could help you deploy and use the nginx Ingress controller https://medium.com/@gokulc/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45. You can find the ip's of your nodes running `kubectl get nodes -o yaml` – Jose Armesto Jan 18 '18 at 10:05