(相关资料图)
Kubernetes云原生集群监控主要涉及到如下三类指标:node物理节点指标、pod & container容器资源指标和Kubernetes云原生集群资源指标。针对这三类指标都有比较成熟的方案,见下图:
上节我们整理了node性能指标如何监控,这一节我们就来分析下cAdvisor性能指标监控。
cAdvisor(Container Advisor)是 Google开源的一个容器监控工具,可用于对容器资源的使用情况和性能进行监控。它以守护进程方式运行,用于收集、聚合、处理和导出正在运行容器的有关信息。具体来说,该组件对每个容器都会记录其资源隔离参数、历史资源使用情况、完整历史资源使用情况的直方图和网络统计信息。cAdvisor本身就对 Docker容器支持,并且还对其它类型的容器尽可能的提供支持,力求兼容与适配所有类型的容器。
由以上介绍我们可以知道,cAdvisor是用于监控容器引擎的,由于其监控的实用性,Kubernetes已经默认将其与 Kubelet融合,所以我们无需再单独部署 cAdvisor组件来暴露节点中容器运行的信息,直接使用 Kubelet组件提供的指标采集地址即可。
本人搭建的 Kubernetes集群环境如下图,后续都是基于该集群演示:
1、访问Prometheus API方式检查:
kubectl get --raw /api/v1/nodes/${1}/proxy/metrics/cadvisor2、创建Prometheus抓取任务job:
- job_name: kubernetes-nodes-cadvisor metrics_path: /metrics scheme: https kubernetes_sd_configs: - role: node api_server: https://apiserver.simon:6443 bearer_token_file: /tools/token.k8s tls_config: insecure_skip_verify: true bearer_token_file: /tools/token.k8s tls_config: insecure_skip_verify: true relabel_configs: # 将标签(.*)作为新标签名,原有值不变 - action: labelmap regex: __meta_kubernetes_node_label_(.*) # 修改NodeIP:10250为APIServerIP:6443 - action: replace regex: (.*) source_labels: ["__address__"] target_label: __address__ replacement: 192.168.52.151:6443 #apiserver - action: replace source_labels: [__meta_kubernetes_node_name] target_label: __metrics_path__ regex: (.*) replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor 3、检查是否接入成功:
4、cAdvisor组件抓取指标列表:
container_fs_write_seconds_total{}container_memory_swap{}container_spec_cpu_shares{}container_ulimits_soft{}container_fs_io_current{}container_fs_reads_bytes_total{}container_fs_writes_merged_total{}container_cpu_user_seconds_total{}container_memory_failcnt{}container_memory_failures_total{}container_cpu_cfs_throttled_seconds_total{}container_cpu_usage_seconds_total{}container_fs_io_time_seconds_total{}container_network_receive_packets_total{}container_spec_memory_reservation_limit_bytes{}cadvisor_version_info{}container_cpu_cfs_periods_total{}container_fs_limit_bytes{}container_fs_sector_writes_total{}container_memory_usage_bytes{}container_memory_working_set_bytes{}container_network_receive_errors_total{}container_network_transmit_packets_dropped_total{}container_spec_cpu_period{}container_file_descriptors{}container_fs_inodes_total{}container_fs_usage_bytes{}container_network_transmit_packets_total{}container_cpu_load_average_10s{}container_fs_writes_bytes_total{}container_memory_cache{}container_spec_cpu_quota{}container_cpu_cfs_throttled_periods_total{}container_network_receive_bytes_total{}container_network_transmit_errors_total{}container_sockets{}container_spec_memory_swap_limit_bytes{}container_threads{}container_threads_max{}container_cpu_system_seconds_total{}container_fs_read_seconds_total{}container_fs_reads_merged_total{}container_fs_sector_reads_total{}container_processes{}container_spec_memory_limit_bytes{}container_fs_inodes_free{}container_network_receive_packets_dropped_total{}container_network_transmit_bytes_total{}container_fs_io_time_weighted_seconds_total{}container_fs_reads_total{}container_fs_writes_total{}container_memory_max_usage_bytes{}container_memory_rss{}container_scrape_error{}container_start_time_seconds{}container_last_seen{}container_memory_mapped_file{}container_tasks_state{}导入3125 或 13025 dashboard,cAdvisor性能监控指标就展示到模板上,如下图:
哈啰出行投资成立装饰工程公司 注册资本200万元
企查查APP显示,3月18日,上海钧住装饰工程有限公司成立,法定代表...中老铁路的背后 “税务专车”一路同行
2021年12月3日中老铁路正式开通运营,仅需...云南永善佛滩顺河梯级电站全面推进建设
日前,云南省永善县顺河村举行了佛滩顺河...人社部发布信用管理师国家职业技能标准
近日,人力资源和社会保障部对外发布了《...中国生态环境保护实现“十四五”起步之年良好开局
中国生态环境部7日在北京召开2022年全国...观察:中国首条民营控股高铁开通之“时”与“势”
杭台高铁首趟列车即将发车。张煜欢摄1月8...中国黄金消费市场渐回暖 “古法金”饰品获年轻消费者青睐
2022世界珠宝发展大会正在海口举行。8日在...宁吉喆:2021年中国GDP将连续第二年超百万亿元
中国国家发改委副主任兼中国国家统计局...北交所董事长徐明:北交所成立以来股票平均上涨98.9%
北京证券交易所董事长徐明8日表示,北交所...2021年北向资金流入超4300亿元 外资热情拥抱中国资产
尽管面临疫情反复等多重不利因素,外资在2...Copyright © 2015-2022 现在建筑工程网版权所有 备案号:粤ICP备18023326号-5 联系邮箱:855 729 8@qq.com