diff --git a/README.md b/README.md index 6f2a18a..fda3f88 100644 --- a/README.md +++ b/README.md @@ -146,9 +146,11 @@ http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kube 对于Mac环境 ```shell -TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}') -kubectl config set-credentials docker-desktop --token="${TOKEN}" -echo $TOKEN +kubectl apply -f mac/sa.yaml,mac/crb.yaml +#TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}') +#kubectl config set-credentials docker-desktop --token="${TOKEN}" +#echo $TOKEN +kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}" ``` 对于Windows环境 diff --git a/mac/crb.yaml b/mac/crb.yaml new file mode 100644 index 0000000..d88c871 --- /dev/null +++ b/mac/crb.yaml @@ -0,0 +1,12 @@ +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 diff --git a/mac/sa.yaml b/mac/sa.yaml new file mode 100644 index 0000000..54cabb7 --- /dev/null +++ b/mac/sa.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: admin-user + namespace: kubernetes-dashboard