fix: get secret tokens for dashboard login in v1.24

pull/1166/head
jin.gjm 2022-06-07 20:39:15 +08:00
parent 356a98ed48
commit 86e6f08158
3 changed files with 21 additions and 2 deletions

View File

@ -48,7 +48,7 @@ kubectl logs -n kube-system kubernetes-dashboard-698d4c759b-67gzg
``` bash ``` bash
# 获取 Bearer Token找到输出中 token: 开头的后面部分 # 获取 Bearer Token找到输出中 token: 开头的后面部分
$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') $ kubectl describe -n kube-system secrets admin-user
``` ```
- Token令牌方式登录只读 - Token令牌方式登录只读
@ -57,7 +57,7 @@ $ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | g
``` bash ``` bash
# 获取 Bearer Token找到输出中 token: 开头的后面部分 # 获取 Bearer Token找到输出中 token: 开头的后面部分
$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep read-user | awk '{print $1}') $ kubectl describe -n kube-system secrets dashboard-read-user
``` ```
- Kubeconfig登录admin - Kubeconfig登录admin

View File

@ -18,3 +18,12 @@ subjects:
name: admin-user name: admin-user
namespace: kube-system namespace: kube-system
---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: admin-user
namespace: kube-system
annotations:
kubernetes.io/service-account.name: "admin-user"

View File

@ -163,3 +163,13 @@ rules:
- get - get
- list - list
- watch - watch
---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: dashboard-read-user
namespace: kube-system
annotations:
kubernetes.io/service-account.name: "dashboard-read-user"