首页 > Web开发 > 详细

Kubernetes Dashboard可视化插件和Heapster监控组件部署(二)

时间:2019-08-14 09:56:46      阅读:100      评论:0      收藏:0      [点我收藏+]
(一)、Dashboard可视化插件部署
在 Kubernetes Dashboard 中可以查看集群中应用的运行状态,也能够创建和修改各种 Kubernetes 资源,比如 Deployment、Job、DaemonSet 等。用户可以 Scale Up/Down Deployment、执行 Rolling Update、重启某个 Pod 或者通过向导部署新的应用。Dashboard 能显示集群中各种资源的状态以及日志信息。
可以说,Kubernetes Dashboard 提供了 kubectl 的绝大部分功能,大家可以根据情况进行选择。
github地址:
https://github.com/kubernetes/dashboard
具体步骤如下:
1、下载官方提供的Dashboard组件的yaml文件

[root@DEV004021 ~]# wget http://mirror.faasx.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
--2019-08-13 10:58:15--  http://mirror.faasx.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
Resolving mirror.faasx.com (mirror.faasx.com)... 101.89.125.212, 101.89.125.213, 101.89.125.214, ...
Connecting to mirror.faasx.com (mirror.faasx.com)|101.89.125.212|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4734 (4.6K) [text/yaml]
Saving to: ‘kubernetes-dashboard.yaml’

100%[===========================================================================================>] 4,734       --.-K/s   in 0s      

2019-08-13 10:58:15 (12.4 MB/s) - ‘kubernetes-dashboard.yaml’ saved [4734/4734]

2、修改yaml文件中的镜像
技术分享图片

3、修改yaml文件中的Dashboard Service,使其对外能够访问
技术分享图片
4、启动Dashboard,并查看相关服务

[root@DEV004021 opt]# kubectl apply -f kubernetes-dashboard.yaml 
secret/kubernetes-dashboard-certs unchanged
clusterrolebinding.rbac.authorization.k8s.io/admin-user unchanged
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal unchanged
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal unchanged
deployment.apps/kubernetes-dashboard unchanged
service/kubernetes-dashboard unchanged
[root@DEV004021 opt]# kubectl --namespace=kube-system get deployment kubernetes-dashboard
NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
kubernetes-dashboard   1/1     1            1           3d19h
[root@DEV004021 opt]# kubectl --namespace=kube-system get service kubernetes-dashboard
NAME                   TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)         AGE
kubernetes-dashboard   NodePort   10.1.104.20   <none>        443:31111/TCP   3d19h

5、访问Dashboard。地址是必须添加https
技术分享图片
6、创建访问用户

---
# ------------------- Dashboard Service Account ------------------- #

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system
apiVersion: 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
---

7、获取登陆dsahboard的令牌,登陆面板如下:

[root@DEV004021 opt]# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk ‘{print $1}‘)

技术分享图片

(二)、监控组件Heapster部署。
Heapster 用于计算并分析集群资源利用率、监控集群容器。
1、下载Heapster组件部署的yaml文件

# 新建文件夹,用于存放 Heapster 部署所需的 yaml 文件
mkdir heapster
cd heapster

# 获取相关 yaml 文件
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/grafana.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/heapster.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/influxdb.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/rbac/heapster-rbac.yaml

2、修改yaml中的image值,把k8s.gcr.io 全部修改为 registry.cn-hangzhou.aliyuncs.com/google_containers

3、部署Heapster

[root@DEV004021 heapster]# kubectl create -f /opt/heapster/
deployment.extensions/monitoring-grafana created
service/monitoring-grafana created
clusterrolebinding.rbac.authorization.k8s.io/heapster created
serviceaccount/heapster created
deployment.extensions/heapster created
service/heapster created
deployment.extensions/monitoring-influxdb created
service/monitoring-influxdb created

4、查看效果
技术分享图片

Kubernetes Dashboard可视化插件和Heapster监控组件部署(二)

原文:https://blog.51cto.com/liqingbiao/2429084

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!