首页 > 其他分享 >metrics-server - unable to fully collect metrics

metrics-server - unable to fully collect metrics

时间:2023-02-02 18:22:49浏览次数:39  
标签:collect -- fully server metrics kubelet unable 节点

目录

部署 metrics-server 的前提条件

  • 要保证 apiserver 所在节点和 metrics-serevrpod 之间网络可以互通 [ kubeadm 部署的集群会部署相应的 work 节点组件 ]
  • 要保证 apiserver 配置中开启了聚合配置 [ kubeadm 部署的集群,默认开启了聚合 ]

部署 metrics-server 需要注意的地方

修改镜像的 tag

  • 官方下载下来的镜像是国外仓库的,国内很难拉取
sed -i 's#k8s.gcr.io#registry.cn-hangzhou.aliyuncs.com/google_containers#g' components.yaml

修改前

image: k8s.gcr.io/metrics-server-amd64:v0.3.6

修改后

image: registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6

修改启动参数

修改前

  • 官方只有两个启动参数
args:
  - --cert-dir=/tmp
  - --secure-port=4443

修改后

  • metric-resolution : 从 kubelet 采集数据的周期,默认为 60s
  • kubelet-preferred-address-types : 优先使用 InternalIP 来访问 kubelet,这样可以避免节点名称没有 DNS 解析记录时,通过节点名称调用节点 kubelet API 失败的情况
    • 默认为 Hostname,InternalDNS,InternalIP,ExternalDNS,ExternalIP
  • kubelet-insecure-tls : 不要验证 kubelet 提供的服务证书
- args:
  - --cert-dir=/tmp
  - --secure-port=4443
  - --metric-resolution=10s
  - --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
  - --kubelet-insecure-tls

不完整的报错合集

没有配置 --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP

  • metrics-server 会有类似如下的报错
E0907 14:29:51.774592       1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:<node_name>: unable to 
fetch metrics from Kubelet <node_name> (<node_name>): Get https://<node_name>:10250/stats/summary/: dial tcp: lookup <node_name> on 10.96.0.10:53: no such host, unable to fully scr
ape metrics from source kubelet_summary:<node_name>: unable to fetch metrics from Kubelet <node_name> (<node_name>): Get https://<node_name>:10250/stats/summary/: dial tcp: lookup 
<node_name> on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:<node_name>: unable to fetch metrics from Kubelet <node_name> (<node_name>): 
Get https://<node_name>:10250/stats/summary/: dial tcp: lookup <node_name> on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:<node_name>: unable to fetch metrics from Kubelet <node_name> (<node_name>): Get https://<node_name>:10250/stats/summary/: dial tcp: lookup <node_name> on 10.96.0.10:53: no such host]
E0907 14:30:10.517886       1 reststorage.go:112] unable to fetch node metrics for node "<node_name>": no metrics known for node "<node_name>"
  • 当然,也可以在 metrics-server 里面增加 hosts 解析

没有配置 --kubelet-insecure-tls

x509: certificate signed by unknown authority

apiserver 节点与 metrics-server pod 之间网络不通

  • metrics-server 会有类似如下的报错
unable to fully collect metrics: unable to fully scrape metrics from source kubelet_summary:<node_name>: unable to get CPU for container "metrics-server" in pod kube-system/metrics-server-7db5b7cb7c-pkcjb on node "<node_name>", discarding data: missing cpu usage metric
  • 在 apiserver 里可以看到类似如下的报错
v1beta1.metrics.k8s.io failed with: failing or missing response from https://172.30.1.16:4443/apis/metrics.k8s.io/v1beta1: Get "https://172.30.1.16:4443/apis/metrics.k8s.io/v1beta1": context deadline exceeded
v1beta1.metrics.k8s.io failed with: failing or missing response from https://172.30.1.16:4443/apis/metrics.k8s.io/v1beta1: Get "https://172.30.1.16:4443/apis/metrics.k8s.io/v1beta1": dial tcp 172.30.1.16:4443: i/o timeout

个人场景

  • 前期使用的二进制部署的 k8s 集群,当时的规划是 master 节点不运行 pod,于是没有安装 flannel 插件
    • 整体部署中,flannel 采用了 pod 的形式部署,如果 master 节点要部署 flannel,等同于 master 节点需要复用 work 节点,与原先的期望不符合
  • 于是在 master 节点复用 node 节点的情况下,将节点标记为不可调度驱逐所有负载

将节点标记为不可调度

kubectl cordon <node name>

驱逐节点 pod ,保留 daemonset 类型的 pod

kubectl drain <node name> --ignore-daemonsets

标签:collect,--,fully,server,metrics,kubelet,unable,节点
From: https://www.cnblogs.com/chen2ha/p/17086967.html

相关文章

  • Unity性能优化(三) 垃圾回收,Garbage Collection,GC
    Unity的内存管理Unity由两部分内存来组成,原生内存(NativeMemory)和托管内存(ManagedMemory)。其中NativeMemory是引擎管理的内存,大家接触的会比较少,而且可操控性也比较......
  • MAUI新生6.4-集合内容类控件难点:CollectionView
    一、基本使用(数据源在ViewModel中硬编码)//①在Models文件夹下,新建Employee.cs文件,创建Employee类型publicclassEmployee{publicintId{get;set;}publ......
  • 【KAWAKO】speechmetrics-语音方面评价指标库的安装与使用
    目录简介安装将工程以压缩包形式下载到本地把压缩包传到服务器(你想部署的地方)上进行解压用编辑器打开setup.py进行修改在工程目录下进行安装测试简介speechmetrics库提供......
  • 部署 metrics-server
    安装metrics-server通过kubeadm安装的k8s集群默认是没有安装metrics-server,因此需要手工安装。k8s版本v1.22.2系统AnolisO......
  • 集合框架体系Collection和Map常用API【汇总】
    集合框架体系Collection和Map常用API【汇总】Collection公共的方法Collection是单列结合的顶层接口,它的方法是所有单列集合都可以继承使用的。//把给定元素添加到集......
  • Intro to Dropwizard Metrics
    https://www.baeldung.com/dropwizard-metricsQ:What'sDropwizard?A:Purples:developRESTfulwebserviceMainlibraries:Jetty,Jersey,Jackson,JUnit,andG......
  • CSharp: Collection
    usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceCSharpDataStructuresAlgorithms......
  • Java源码解析 Collection<E>
    位置: java.util.Collection<E>interface用途:参数:<E>Iterable<E>子类:接口:方法   int size();  返回这......
  • Java反序列化-CommonsCollections2利用链分析
    前言接上篇TemplatesImpl利用链分析,学习了通过TemplatesImpl利用链来进行类加载执行恶意代码,现在来学习一下CommonsCollections2利用链。分析前的准备漏洞组件:commons-c......
  • 基于全卷积Fully-Convolutional-Siamese-Networks的目标跟踪仿真
    1.算法概述1.正确版本组合:Win7+MatlabR2015b+CUDA7.5+vs2013CUDA7.5下载地址为:http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.......