创建服务账户/查询访问token

# [root@etcd0 ~]# 1.创建账户
kubectl create clusterrolebinding kubelet-api-test
--clusterrole=system:kubelet-api-admin
--serviceaccount=default:kubelet-api-test
# clusterrolebinding.rbac.authorization.k8s.io/kubelet-api-test created
# [root@etcd0 ~]# 2、查询密文
SECRET=$(kubectl get secrets | grep kubelet-api-test | awk '{print $1}')
# [root@etcd0 ~]# 3、提取访问token
TOKEN=$(kubectl describe secret ${SECRET} | grep -E '^token' | awk '{print $2}')
# [root@etcd0 ~]# echo ${TOKEN}
posted @ 2020-06-27 20:26  FromScratch  阅读(200)  评论(0编辑  收藏  举报