跟着炎炎盐实践k8s---应用部署之Kubernetes Dashboard

技术积累LZ 2020-07-28

Dashboard 介绍
仪表板是Kubernetes提供给用户的图形化界面。可以使用仪表板来查看群集上运行的容器应用,以及创建或修改Kubernetes资源(例如部署,作业,守护进程等),还可以启动滚动更新,重新启动Pod或部署新应用程序,查看日志、事件等。
跟着炎炎盐实践k8s---应用部署之Kubernetes Dashboard

一、部署

1、Dashboard的部署配置
cat > dashboard.yaml <<EOF
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: admin
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: admin
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin
  namespace: kube-system
  labels:
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
EOF
2、Dashboard的RBAC配置文件

cat > dashboard-admin.yaml <<EOF
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: admin
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: admin
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin
  namespace: kube-system
  labels:
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
EOF
3、部署dashboard

kubectl create -f dashboard.yaml
kubectl create -f dashboard-admin.yaml

二、登陆

1、打开IP:30081
跟着炎炎盐实践k8s---应用部署之Kubernetes Dashboard
2、获取tocken

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep kubernetes-dashboard-token-jc8gh | awk ‘{print $1}‘) |grep token

将token复制到框内点击登陆,部署完成。

相关推荐