码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2020-07-28 10:21:52      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:群集   日志   yaml   运行   资源   des   mes   manage   int   

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

一、部署

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
技术图片
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复制到框内点击登陆,部署完成。

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

标签:群集   日志   yaml   运行   资源   des   mes   manage   int   

原文地址:https://blog.51cto.com/13534471/2513896

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!