metrics-server的错误

发布时间:2020年03月02日 阅读:112 次

我们部署完metrics-server后kubectl top node时很多节点是<unknown>错误的

root@master1:/opt/prometheus/metrics-server# kubectl top node
NAME                                 CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%     
cn-hangzhou.i-bp1383wsko3fteg1doii   88m          0%     25182Mi         20%                         
cn-hangzhou.i-bp1j39cr29g1fhi1qn4m   306m         2%     9049Mi          31%         
cn-hangzhou.i-bp1ewjfuaonpfw7sat1l   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp13dduprcf5mz1ctj34   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp1d4rursi996e7eaqas   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp1c271nqm25lv3yj0ds   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp18zi7ua63844alc2je   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp1c271nqm25lv3yj0dt   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp1d4rursi996e7eaqat   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp1g7004ksh260immsvd   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp11nv53mkrrqc1610r4   <unknown>                           <unknown>               <unknown>               <unknown>               
cn-hangzhou.i-bp11qnvovd6tj2jd7utg   <unknown>                           <unknown>               <unknown>               <unknown>


我们查看日志:

unable to fully scrape metrics from source kubelet_summary:cn-hangzhou.i-bp1flxrsvye1tn38ch4v: unable to fetch metrics from Kubelet cn-hangzhou.i-bp1flxrsvye1tn38ch4v (cn-hangzhou.i-bp1flxrsvye1tn38ch4v): Get https://cn-hangzhou.i-bp1flxrsvye1tn38ch4v:10250/stats/summary?only_cpu_and_memory=true: dial tcp: lookup cn-hangzhou.i-bp1flxrsvye1tn38ch4v on 10.2.0.10:53: no such host]

看样子是用主机名解析不到,于是更改为ip方式

在metrics-server的deployment启动参数添加
command: - /metrics-server 
         - --kubelet-preferred-address-types=InternalIP    #默认使用主机名访问,改为ip

重启pod完再回去查看就ok了。



Tag:metrics-server
相关文章

发表评论: