kubernetes监控-Heapster+InfluxDB+Grafana(十五)
cAdvisor+InfluxDB+Grafana
cAdvisor:是谷歌开源的一个容器监控工具,采集主机上容器相关的性能指标数据。比如CPU、内存、网络、文件系统等。
Heapster是谷歌开源的集群监控数据收集工具,会所有节点监控数据,Heapster作为一个pod在集群中运行,通过API获得集群中的所有节点,然后从节点kubelet暴露的10255汇总数据。目前社区用Metrics Server 取代 Heapster。
InfluxDB:时序数据库,存储监控数据。
Grafana:可视化展示。Grafana提供一个易于配置的仪表盘UI,可以轻松定制和扩展。
不足
l 功能单一,无法做到对K8S资源对象监控
l 告警单一,利用Grafana基本告警
l 依赖Influxdb,而Influxdb单点(高可用商业才支持),缺少开源精神
l heapster在1.8+弃用,metrics-server取代
部署heapster组件
[root@localhost monitor]# cat heapster.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: heapster
namespace: kube-system --- kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: heapster
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system --- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
task: monitoring
k8s-app: heapster
spec:
serviceAccountName: heapster
containers:
- name: heapster
image: registry.cn-hangzhou.aliyuncs.com/google-containers/heapster-amd64:v1.5.1
imagePullPolicy: IfNotPresent
command:
- /heapster
- --source=kubernetes:https://kubernetes.default
- --sink=influxdb:http://monitoring-influxdb:8086 --- apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: Heapster
name: heapster
namespace: kube-system
spec:
ports:
- port: 80
targetPort: 8082
selector:
k8s-app: heapster
使用top命令
[root@localhost monitor]# kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
192.168.0.220 208m % 1978Mi %
192.168.0.221 137m % 1068Mi %
192.168.0.222 135m % 1009Mi %
[root@localhost monitor]# kubectl top pods
NAME CPU(cores) MEMORY(bytes)
nginx-7db9fccd9b-qkb7t 0m 2Mi
nginx-7db9fccd9b-wtvk8 0m 3Mi
nginx-7db9fccd9b-xxkzb 0m 2Mi
登录Dashboard即可查看到对应的监控图表
部署grafana和influxdb
[root@localhost monitor]# cat grafana.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-grafana
namespace: kube-system
spec:
replicas:
template:
metadata:
labels:
task: monitoring
k8s-app: grafana
spec:
containers:
- name: grafana
image: registry.cn-hangzhou.aliyuncs.com/google-containers/heapster-grafana-amd64:v4.4.1
ports:
- containerPort:
protocol: TCP
volumeMounts:
- mountPath: /var
name: grafana-storage
env:
- name: INFLUXDB_HOST
value: monitoring-influxdb
- name: GF_AUTH_BASIC_ENABLED
value: "false"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: Admin
- name: GF_SERVER_ROOT_URL
value: /
volumes:
- name: grafana-storage
emptyDir: {} --- apiVersion: v1
kind: Service
metadata:
labels:
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-grafana
name: monitoring-grafana
namespace: kube-system
spec:
type: NodePort
ports:
- port :
targetPort:
selector:
k8s-app: grafana [root@localhost monitor]# cat influxdb.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-influxdb
namespace: kube-system
spec:
replicas:
template:
metadata:
labels:
task: monitoring
k8s-app: influxdb
spec:
containers:
- name: influxdb
image: registry.cn-hangzhou.aliyuncs.com/google-containers/heapster-influxdb-amd64:v1.1.1
volumeMounts:
- mountPath: /data
name: influxdb-storage
volumes:
- name: influxdb-storage
emptyDir: {} --- apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-influxdb
name: monitoring-influxdb
namespace: kube-system
spec:
ports:
- port:
targetPort:
selector:
k8s-app: influxdb [root@localhost monitor]# kubectl apply -f .
deployment.extensions/monitoring-grafana unchanged
service/monitoring-grafana unchanged
serviceaccount/heapster unchanged
clusterrolebinding.rbac.authorization.k8s.io/heapster unchanged
deployment.extensions/heapster unchanged
service/heapster unchanged
deployment.extensions/monitoring-influxdb unchanged
service/monitoring-influxdb unchanged
查看
[root@localhost monitor]# kubectl get pod,svc,deploy -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/coredns-5b8c57999b-z9jh8 / Running 22h 172.17.52.3 192.168.0.220 <none> <none>
pod/heapster-77f96f6f6c-qcr98 / Running 14m 172.17.52.2 192.168.0.220 <none> <none>
pod/kubernetes-dashboard-644c96f9c6-bvw8w / Running 23h 172.17.100.2 192.168.0.222 <none> <none>
pod/monitoring-grafana--cb86b / Running 8m55s 172.17.100.5 192.168.0.222 <none> <none>
pod/monitoring-influxdb-58b849b9f8-t26p8 / Running 8m52s 172.17.50.4 192.168.0.221 <none> <none> NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
service/heapster ClusterIP 10.0.0.208 <none> /TCP 14m k8s-app=heapster
service/kube-dns ClusterIP 10.0.0.2 <none> /UDP,/TCP 23h k8s-app=kube-dns
service/kubernetes-dashboard NodePort 10.0.0.84 <none> :/TCP 23h k8s-app=kubernetes-dashboard
service/monitoring-grafana NodePort 10.0.0.252 <none> :/TCP 14m k8s-app=grafana
service/monitoring-influxdb ClusterIP 10.0.0.85 <none> /TCP 14m k8s-app=influxdb
访问grafana:http://192.168.0.222:35811
导入图表
kubernetes监控-Heapster+InfluxDB+Grafana(十五)的更多相关文章
- kubernetes 监控方案之:heapster+influxdb+grafana(十八)
目录 一.Heapster 介绍 二.部署 三.使用 heapster 已经 deprecated 了:https://github.com/kubernetes/heapster,所以下面的演示主要 ...
- 详解k8s原生的集群监控方案(Heapster+InfluxDB+Grafana) - kubernetes
1.浅析监控方案 heapster是一个监控计算.存储.网络等集群资源的工具,以k8s内置的cAdvisor作为数据源收集集群信息,并汇总出有价值的性能数据(Metrics):cpu.内存.netwo ...
- kubernetes监控和性能分析工具:heapster+influxdb+grafana
1.部署heapster 下载 heapster 相关 yaml 文件 [root@master dashboard]# wget https://raw.githubusercontent.com/ ...
- 介绍Kubernetes监控Heapster
什么是Heapster? Heapster是容器集群监控和性能分析工具,天然的支持Kubernetes和CoreOS,Kubernetes有个出名的监控agent—cAdvisor.在每个kubern ...
- jmeter-性能监控(InfluxDB+Grafana)
测试结果实时监控:jmeter+influxdb+grafana InfluxDB:存储实时数据的DB Grafana:DB中存储的实时数据可以在浏览器查看 --------------------- ...
- 建立Heapster Influxdb Grafana集群性能监控平台
依赖于kubenets dns服务 图形化展示度量指标的实现需要集成k8s的另外一个Addons组件: Heapster .Heapster原生支持K8s(v1.0.6及以后版本)和 CoreOS , ...
- Kubernetes学习之路(十五)之Ingress和Ingress Controller
目录 一.什么是Ingress? 1.Pod 漂移问题 2.端口管理问题 3.域名分配及动态更新问题 二.如何创建Ingress资源 三.Ingress资源类型 1.单Service资源型Ingres ...
- Kubernetes监控:部署Heapster、InfluxDB和Grafana
本节内容: Kubernetes 监控方案 Heapster.InfluxDB和Grafana介绍 安装配置Heapster.InfluxDB和Grafana 访问 grafana 访问 influx ...
- kubernetes监控-prometheus(十六)
监控方案 cAdvisor+Heapster+InfluxDB+Grafana Y 简单 容器监控 cAdvisor/exporter+Prometheus+Grafana Y 扩展性好 容器,应用, ...
随机推荐
- encodeURI和uncodeURIComponent的介绍
encodeURI.decodeURI encodeURI.decodeURI 对字符转义:不替换特殊字符有18个.(大小写)字母.数字. 替换目标 将字符替换为 HTML URL编码 替换范围 A- ...
- UE4中资源加载资源的方式
在UNITY中,我们加载资源一般是通过Resources.Load(path).即可完成.该方法返回的是Object类型.如果你想要的是材质或者贴图等等,只要价格类型转换的关键字就可以了例如 as M ...
- AcDbCurve of AcDbEntity
AcDb2dPolyline AcDb3dPolyline AcDbArc AcDbCircle AcDbEllipse AcDbLeader AcDbLine AcDbPolyline AcDbRa ...
- 通过node.js读取html页面及其页面中引入的css样式
Node 是什么? Node 是一个基于Chrome V8 引擎的JavaScript 运行环境. Node 不是一种独立的语言.Node不是 JavaScript 框架, Node是一个除了浏览器之 ...
- iphone6 iphone6 plus 放大显示模式高分辨率模式问题
分为兼容模式和高分辨率模式. 兼容模式 当你的 app 没有提供 3x 的 LaunchImage 时,系统默认进入兼容模式,大屏幕一切按照 320 宽度渲染,屏幕宽度返回 320:然后等比例拉伸到大 ...
- Oracle树查询总结
最近在做公司的项目中遇到一个问题,多级级联导航菜单,虽然只有三级目录,但<li>中嵌套<ul>,数据库表结构如下: CREATE TABLE FLFL ( ID NUMBER ...
- eclipse中windows下的preferences左栏没有tomcat?
是因为缺少eclipse for tomcat 插件,到http://www.eclipsetotale.com/tomcatPlugin.html此网站下载,我的eclipse版本是4.4版本的,所 ...
- JMeter(6) jenkins测试报告及邮件优化
jenkins邮件 使用jenkins执行完任务自动将测试结果发送到邮箱,效果如下: 生成html报告 build文件设置 jenkins设置 SummaryReport写入邮件正文 ...
- Codeforces Round #431 (Div. 2) B
Connect the countless points with lines, till we reach the faraway yonder. There are n points on a c ...
- NET Core应用可以同时运行在Windows Container和Linux Container-1
NET Core多平台开发体验[1]: Windows 微软在千禧年推出 .NET战略,并在两年后推出第一个版本的.NET Framework和IDE(Visual Studio.NET 2002,后 ...