/images/touxiang.jpg

client-go库使用token连接Apiserver

基本准备 1 2 3 4 5 6 7 8 9 # 创建sa、绑定角色 [root@Jenkins-master01 ~]# kubectl create serviceaccount dashboard-admin -n kube-system [root@Jenkins-master01 ~]# kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin #dashboard-admin 绑定为集群账户 # 获取此sa的token值 [root@Jenkins-master01 ~]# kubectl describe secrets -n kube-system $(kubectl -n kube-system