Last active
January 1, 2019 16:06
-
-
Save krainet/ba1814e04abfe39a20fae7d346a7dfe0 to your computer and use it in GitHub Desktop.
Install and setup K8S Dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml | |
#create service account | |
cat <<EOF > k8s-service-account.yaml | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: admin-user | |
namespace: kube-system | |
EOF | |
kubectl apply -f k8s-service-account.yaml | |
cat <<EOF > k8s-cluster-role-binding.yaml | |
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: kube-system | |
EOF | |
kubectl apply -f k8s-cluster-role-binding.yaml | |
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | |
#save this token to use in your local system | |
#setup your local system to login into dashboard (ubuntu) | |
sudo apt-get update && sudo apt-get install -y apt-transport-https | |
sudo snap install kubectl --classic | |
#copy the master file /etc/kubernetes/admin.conf into your $HOME/.kube/config and run: | |
kubectl proxy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment