本文介绍了指标服务器不起作用:无法处理请求(获取nodes.metrics.k8s.io)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行命令 kubectl顶部节点,并收到错误消息:

  node @ kubemaster:〜/Desktop/metric $ kubectl顶级节点服务器发生错误(ServiceUnavailable):服务器当前无法处理请求(获取nodes.metrics.k8s.io) 

Metric Server容器正在使用以下参数运行:

 命令:-/metrics-server---metric-resolution = 30秒---requestheader-allowed-names =聚合器---kubelet-insecure-tls---kubelet-preferred-address-types =内部IP,主机名,内部DNS,外部DNS,外部IP 

我得到的大多数答案是上述参数,仍然出现错误

  E0601 18:33:22.012798 1 manager.go:111]无法完全收集指标:[无法从源kubelet_summary:kubemaster中完全刮取指标:无法从Kubelet kubemaster(192.168.56.30)获取指标:获取https://192.168.56.30:10250/stats/summary?only_cpu_and_memory=true:超出了上下文截止日期,无法从源kubelet_summary:kubenode1中完全删除指标:无法从Kubelet kubenode1(192.168.56.31)获取指标:获取https://192.168.56.31:10250/stats/summary?only_cpu_and_memory=true:拨打tcp 192.168.56.31:10250:I/O超时] 

我已经使用部署了度量服务器:

  kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml 

我想念什么?使用Calico进行Pod联网

在FAQ下的度量服务器的github页面上:

  [Calico]检查calico.yaml中CALICO_IPV4POOL_CIDR的值是否与本地物理网段冲突.默认值:192.168.0.0/16. 

这可能是原因.有人可以给我解释一下吗.

我使用以下命令设置了Calico:kubectl apply -f

I am running command kubectl top nodes and getting error :

node@kubemaster:~/Desktop/metric$ kubectl top nodes
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)

Metric Server pod is running with following params :

    command:
    - /metrics-server
    - --metric-resolution=30s
    - --requestheader-allowed-names=aggregator
    - --kubelet-insecure-tls
    - --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP

Most of the answer I am getting is the above params,Still getting error

E0601 18:33:22.012798       1 manager.go:111] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:kubemaster: unable to fetch metrics from Kubelet kubemaster (192.168.56.30): Get https://192.168.56.30:10250/stats/summary?only_cpu_and_memory=true: context deadline exceeded, unable to fully scrape metrics from source kubelet_summary:kubenode1: unable to fetch metrics from Kubelet kubenode1 (192.168.56.31): Get https://192.168.56.31:10250/stats/summary?only_cpu_and_memory=true: dial tcp 192.168.56.31:10250: i/o timeout]

I have deployed metric server using :

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml

What am I missing?Using Calico for Pod Networking

On github page of metric server under FAQ:

[Calico] Check whether the value of CALICO_IPV4POOL_CIDR in the calico.yaml conflicts with the local physical network segment. The default: 192.168.0.0/16.

Could this be the reason. Can someone explains this to me.

I have setup Calico using : kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml

My Node Ips are : 192.168.56.30 / 192.168.56.31 / 192.168.56.32

I have initiated the cluster with --pod-network-cidr=20.96.0.0/12. So my pods Ip are 20.96.205.192 and so on.

Also getting this in apiserver logs

E0601 19:29:59.362627       1 available_controller.go:420] v1beta1.metrics.k8s.io failed with: failing or missing response from https://10.100.152.145:443/apis/metrics.k8s.io/v1beta1: Get https://10.100.152.145:443/apis/metrics.k8s.io/v1beta1: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

where 10.100.152.145 is IP of service/metrics-server(ClusterIP)

Surprisingly it works on another cluster with Node Ip in 172.16.0.0 range.Rest everything is same. Setup using kudeadm, Calico, same pod cidr

解决方案

It started working after I edited the metrics-server deployment yaml config to include a DNS policy.

hostNetwork: true

Refer to the link below:https://www.linuxsysadmins.com/service-unavailable-kubernetes-metrics/

这篇关于指标服务器不起作用:无法处理请求(获取nodes.metrics.k8s.io)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 12:35