Skip to content

Instantly share code, notes, and snippets.

@cseelye
Last active February 17, 2020 20:40
Show Gist options
  • Save cseelye/cccbacb4a3ce6f5ae2945c09d812d4b7 to your computer and use it in GitHub Desktop.
Save cseelye/cccbacb4a3ce6f5ae2945c09d812d4b7 to your computer and use it in GitHub Desktop.

Deploy kubernetes-dashboard on Docker Desktop k8s cluster

This has security implications that you should understand before applying this to any old cluster... What is "safe" (or at least reasonable risk/convenience tradeoff) on your laptop k8s clsuter is completely different than even a dev/test cluster, much less production.

Deploy the dashboard using the recommended configuration:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

Get the default token and add it to your kubeconfig:

kubectl config set-credentials docker-desktop --token="$(kubectl describe secret default | grep token: | awk '{print $2}')"

Expose the dashboard locally and then connect to it:

kubectl proxy

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

To get rid of the need for kube-proxy, change the Service to a NodePort instead of ClusterIP

kubectl --namespace kubernetes-dashboard patch service kubernetes-dashboard -p '{"spec":{"type": "NodePort"}}'
kubectl --namespace kubernetes-dashboard describe service kubernetes-dashboard | grep NodePort

Now use that NodePort to connect to the dashboard https://localhost:NodePort/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment