代码之家  ›  专栏  ›  技术社区  ›  Ben D

Kubernetes Metrics无法获取pod/节点度量

  •  5
  • Ben D  · 技术社区  · 6 年前

    我已经在kubernetes v1.11.2上安装了metrics服务器。

    我正在运行一个使用3个节点和1个主节点的裸机集群

    在metrics服务器日志中,我有以下错误:

    E0907 14:29:51.774592       1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:vps01: unable to 
    fetch metrics from Kubelet vps01 (vps01): Get https://vps01:10250/stats/summary/: dial tcp: lookup vps01 on 10.96.0.10:53: no such host, unable to fully scr
    ape metrics from source kubelet_summary:vps04: unable to fetch metrics from Kubelet vps04 (vps04): Get https://vps04:10250/stats/summary/: dial tcp: lookup 
    vps04 on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:vps03: unable to fetch metrics from Kubelet vps03 (vps03): 
    Get https://vps03:10250/stats/summary/: dial tcp: lookup vps03 on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:vp
    s02: unable to fetch metrics from Kubelet vps02 (vps02): Get https://vps02:10250/stats/summary/: dial tcp: lookup vps02 on 10.96.0.10:53: no such host]     
    E0907 14:30:01.694794       1 reststorage.go:98] unable to fetch pod metrics for pod boxweb/boxweb-deployment-7756c49688-fz625: no metrics known for pod "bo
    xweb/boxweb-deployment-7756c49688-fz625"                                                                                                                    
    E0907 14:30:10.517886       1 reststorage.go:112] unable to fetch node metrics for node "vps01": no metrics known for node "vps01"
    

    我也无法使用 kubectl上节点vps01

    自动缩放也一样,不起作用

      unable to get metrics for resource cpu: unable to fetch metrics from
     resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)       
    
    2 回复  |  直到 6 年前
        1
  •  4
  •   Eduardo Baitello Rutabaga Man    6 年前

    我找到了以下解决方案:

    更改 metrics-server-deployment.yaml 文件和添加:

    command:
        - /metrics-server 
        - --kubelet-preferred-address-types=InternalIP
        - --kubelet-insecure-tls
    
        2
  •  1
  •   Rico    6 年前

    你的域名系统好像有问题 metrics-server 豆荚。您可以连接到pod:

    kubectl exec -it metrics-server-xxxxxxxxxx-xxxxx -n kube-system sh
    / # ping vps01
    

    如果无法ping,则无法解析节点。

    核心dns或kube dns使用 /etc/resolv.conf 在每个节点上,我也会检查是否可以解析彼此之间的节点。喂,你能平吗 vps01 vps02 vps03 等等。

        3
  •  0
  •   Yoonian    6 年前

    我也遇到了同样的问题,我通过在 /etc/hosts 在每个节点上。

    为了收集度量数据(CPU/内存使用情况),metric server尝试访问节点。但是,metric服务器无法解析主机名( vps01 , vps02 , vps03 ,和 vps04 )因为它们没有在DNS中注册。正如您所提到的,您不能在DNS中注册主机名。

    所以,您必须将主机名添加到 /etc/主机 在运行metrics服务器POD的节点上。

    自动缩放器不工作,因为度量服务器不工作,并且没有度量数据。