Skip to content

Instantly share code, notes, and snippets.

@marcelobrake
Last active October 15, 2020 20:35
Show Gist options
  • Save marcelobrake/7ee90122471d39ffee52425b3cdad589 to your computer and use it in GitHub Desktop.
Save marcelobrake/7ee90122471d39ffee52425b3cdad589 to your computer and use it in GitHub Desktop.
Install Kubernetes Dashboard

Install Kubernetes Dashboard

Instalando

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

kubectl create serviceaccount dashboard-admin-sa
kubectl create clusterrolebinding dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=default:dashboard-admin-sa

Service Account e Cluster Role Binding

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
EOF
cat <<EOF | kubectl apply -f -
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
EOF

Pegar o token para autenticar

kubectl -n default describe secret $(kubectl -n default get secret | awk '/^dashboard-admin-sa-token-/{print $1}') | awk '$1=="token:"{print $2}'
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

Habilitar proxy

kubectl proxy

Abrir no navegador

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=application-service

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