How do I expose the Kubernetes UI Dashboard?

4/18/2017

Per the documentation at: https://kubernetes.io/docs/tasks/web-ui-dashboard/ I ran :

kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml

Then I tried running this to expose the service

cluster/kubectl.sh expose svc/kubernetes

but I keep getting an error:

error: couldn't retrieve selectors via --selector flag or introspection: the service has no pod selector set
See 'kubectl expose -h' for help and examples.

I have looked at the examples but can't understand what I am doing wrong.

kubernetes# cluster/kubectl.sh get all
NAME             CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
svc/kubernetes   10.0.0.1     <none>        443/TCP   7h

kubernetes# cluster/kubectl.sh get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS    RESTARTS   AGE
kube-system   kube-dns-806549836-r6wtk                0/3       Pending   0          7h
kube-system   kubernetes-dashboard-2396447444-9675d   0/1       Pending   0          6h
-- Frank Barcenas
kubernetes

1 Answer

4/19/2017

To get access to the dashboard, usually you would just type:

kubectl cluster-info

Which then gives you all the required urls for accessing your cluster.

-- Norbert van Nobelen
Source: StackOverflow