kubernetes-dashboard獲取令牌登陸
阿新 • • 發佈:2018-12-13
前言:kubernetes核心元件服務啟動正常
一、在kubernetes-dashboard.yaml父級資料夾下建立account.yaml檔案用於訪問kubernetes-dashboard,新增如下配置
# Create Service AccountapiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kube-system ---# Create ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v1beta1 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
二、獲取登陸令牌kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') 獲取輸出的token貼上複製到kubernetes-dashboard登陸頁面獲取授權