Create service account
Ref: https://computingforgeeks.com/create-admin-user-to-access-kubernetes-dashboard/
admin-sa.yml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: techiterian-cluster-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: techiterian-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: techiterian-cluster-admin
namespace: kube-system
Run following command
kubectl apply -f admin-sa.yml
To obtain admin user token
Set a variable to store the name of the service account.
SA_NAME="techiterian-cluster-admin"
To view token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep ${SA_NAME} | awk '{print $1}')
Token obtained from above command can be used to access Kubernetes dashboard
No Comments