Skip to content

Instantly share code, notes, and snippets.

@smijar
Created April 22, 2020 00:50
Show Gist options
  • Save smijar/64e76808c8a349eb64f56c71dc03d8d8 to your computer and use it in GitHub Desktop.
Save smijar/64e76808c8a349eb64f56c71dc03d8d8 to your computer and use it in GitHub Desktop.
k3d-install-dashboard

ref

https://rancher.com/docs/k3s/latest/en/installation/kube-dashboard/

install

Deploying the Kubernetes Dashboard

GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml

add admin user

dashboard-admin-user.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard

add admin user role

dashboard-admin-user-role.yml (has admin privileges)

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

add these yamls

kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml

grep the token

kubectl -n kubernetes-dashboard describe secret admin-user-token | grep ^token

start the proxy to k8s APIs

kubectl proxy

dashboard url is at:

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

@leg1on4rio
Copy link

I had to create a token in order to get it: kubectl -n kubernetes-dashboard create token admin-user

thx, my friend.

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