Kubernetes监控体系(三)之Heapster介绍

本文个人博客地址:http://www.huweihuang.com/article/kubernetes/monitoring/heapster-introduction/

1. heapster简介

Heapster是容器集群监控和性能分析工具,支持Kubernetes和CoreOS。
Kubernetes有个监控agent—cAdvisor。在每个kubernetes Node上都会运行cAdvisor,它会收集本机以及容器的监控数据(cpu,memory,filesystem,network,uptime)。

2. heapster部署与配置

2.1. 注意事项

需同步部署机器和被采集机器的时间:ntpdate time.windows.com

加入定时任务,定期同步时间

crontab –e

30 5 * * * /usr/sbin/ntpdate time.windows.com //每天早晨5点半执行

2.2. 容器式部署

以下为示例,请拉取官方镜像,根据实际情况修改参数。

#拉取镜像
docker pull heapster:latest
#运行容器
docker run -d -p 8082:8082 --net=host heapster:latest --source=kubernetes:http://<k8s-server-ip>:8080?inClusterConfig=false\&useServiceAccount=false --sink=influxdb:http://<influxdb-ip>:8086?db=<k8s_env_zone>

2.3. 配置说明

可以参考官方文档

2.3.1. –source

–source: 指定数据获取源。这里指定kube-apiserver即可。
后缀参数:
inClusterConfig:
kubeletPort: 指定kubelet的使用端口,默认10255
kubeletHttps: 是否使用https去连接kubelets(默认:false)
apiVersion: 指定K8S的apiversion
insecure: 是否使用安全证书(默认:false)
auth: 安全认证
useServiceAccount: 是否使用K8S的安全令牌

2.3.2. –sink

–sink: 指定后端数据存储。这里指定influxdb数据库。
后缀参数:
user: InfluxDB用户
pw: InfluxDB密码
db: 数据库名
secure: 安全连接到InfluxDB(默认:false)
withfields: 使用InfluxDB fields(默认:false)。

3. Metrics

分类Metric NameDescription备注
cpucpu/limitCPU hard limit in millicores.CPU上限
cpu/node_capacityCpu capacity of a node.Node节点的CPU容量
cpu/node_allocatableCpu allocatable of a node.Node节点可分配的CPU
cpu/node_reservationShare of cpu that is reserved on the node allocatable.
cpu/node_utilizationCPU utilization as a share of node allocatable.
cpu/requestCPU request (the guaranteed amount of resources) in millicores.
cpu/usageCumulative CPU usage on all cores.CPU总使用量
cpu/usage_rateCPU usage on all cores in millicores.
filesystemfilesystem/usageTotal number of bytes consumed on a filesystem.文件系统的使用量
filesystem/limitThe total size of filesystem in bytes.文件系统的使用上限
filesystem/availableThe number of available bytes remaining in a the filesystem可用的文件系统容量
filesystem/inodesThe number of available inodes in a the filesystem
filesystem/inodes_freeThe number of free inodes remaining in a the filesystem
memorymemory/limitMemory hard limit in bytes.内存上限
memory/major_page_faultsNumber of major page faults.
memory/major_page_faults_rateNumber of major page faults per second.
memory/node_capacityMemory capacity of a node.
memory/node_allocatableMemory allocatable of a node.
memory/node_reservationShare of memory that is reserved on the node allocatable.
memory/node_utilizationMemory utilization as a share of memory allocatable.
memory/page_faultsNumber of page faults.
memory/page_faults_rateNumber of page faults per second.
memory/requestMemory request (the guaranteed amount of resources) in bytes.
memory/usageTotal memory usage.
memory/cacheCache memory usage.
memory/rssRSS memory usage.
memory/working_setTotal working set usage. Working set is the memory being used and not easily dropped by the kernel.
networknetwork/rxCumulative number of bytes received over the network.
network/rx_errorsCumulative number of errors while receiving over the network.
network/rx_errors_rateNumber of errors while receiving over the network per second.
network/rx_rateNumber of bytes received over the network per second.
network/txCumulative number of bytes sent over the network
network/tx_errorsCumulative number of errors while sending over the network
network/tx_errors_rateNumber of errors while sending over the network
network/tx_rateNumber of bytes sent over the network per second.
uptimeNumber of milliseconds since the container was started.

4. Labels

Label NameDescription
pod_idUnique ID of a Pod
pod_nameUser-provided name of a Pod
pod_namespaceThe namespace of a Pod
container_base_imageBase image for the container
container_nameUser-provided name of the container or full cgroup name for system containers
host_idCloud-provider specified or user specified Identifier of a node
hostnameHostname where the container ran
labelsComma-separated(Default) list of user-provided labels. Format is ‘key:value’
namespace_idUID of the namespace of a Pod
resource_idA unique identifier used to differentiate multiple metrics of the same type. e.x. Fs partitions under filesystem/usage

5. heapster API

见官方文档:https://github.com/kubernetes/heapster/blob/master/docs/model.md

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值