kubernetes-dashboard获取令牌登陆

前言: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

2、获取登陆令牌kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

获取输出的token粘贴复制到kubernetes-dashboard登陆页面获取授权

kubernetes-dashboard获取令牌登陆

相关推荐