dashboard使用与访问
#dashboard的github地址 https://github.com/kubernetes/dashboard #下载 wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml #导入 kubectl apply -f kubernetes-dashboard.yaml #给kubernetes-dashboard 打补丁(类型改成nodeport)(或者使用ingress配置dashboard,让外面访问) kubectl patch svc kubernetes-dashboard -p '{"spec":{"type":"NodePort"}}' -n kube-system #查看 [root@master ~]# kubectl get svc -n kubernetes-dashboard NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-metrics-scraper ClusterIP 10.111.113.162 8000/TCP 16m kubernetes-dashboard NodePort 10.100.201.152 443:30424/TCP 16m #访问 在浏览器输入宿主机的公网ip+nodeport映射的端口 https://IP:port
#创建超级用户
vi dashboard-admin-rbac.yaml apiVersion: v1 kind: ServiceAccount metadata: labels: k8s-app: kubernetes-dashboard name: kubernetes-dashboard-admin namespace: kubernetes-dashboard --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: kubernetes-dashboard-admin labels: k8s-app: kubernetes-dashboard roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: kubernetes-dashboard-admin namespace: kubernetes-dashboard #导入 kubectl apply -f dashboard-admin-rbac.yaml #查看token名称 [root@master kubernetes-dashboard]# kubectl get secret -n kubernetes-dashboard |grep admin kubernetes-dashboard-admin-token-q2cbr kubernetes.io/service-account-token 3 10m #查看token #方法一、kubectl get secret kubernetes-dashboard-admin-token-q2cbr -n kubernetes-dashboard -o jsonpath={".data.token"}|base64 -d kubectl describe -n kubernetes-dashboard secret kubernetes-dashboard-admin-token-q2cbr |grep ^token^token
#复制token到令牌框中
中文设置