“Failed to scrape node“ err=“Get \“https://:10250/metrics/resource\“: x509: cannot validate故障排除

起因实验环境的metrics-server状态一直是0/1 Running

1. 报错信息

用kubectl logs -n kube-system metrics-server-67db5c9b4f-kmflf查看容器时,出现以下报错.

I0403 00:53:12.159359       1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
I0403 00:53:22.159679       1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
E0403 00:53:26.965752       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.51:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.51 because it doesn't contain any IP SANs" node="node-01"
E0403 00:53:26.983120       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.41:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.41 because it doesn't contain any IP SANs" node="master-01"
E0403 00:53:26.983215       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.52:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.52 because it doesn't contain any IP SANs" node="node-02"
I0403 00:53:32.159983       1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
E0403 00:53:41.967697       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.52:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.52 because it doesn't contain any IP SANs" node="node-02"
E0403 00:53:41.980183       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.41:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.41 because it doesn't contain any IP SANs" node="master-01"
E0403 00:53:41.982200       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.51:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.51 because it doesn't contain any IP SANs" node="node-01"
I0403 00:53:42.159965       1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
I0403 00:53:52.159198       1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
E0403 00:53:56.959022       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.51:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.51 because it doesn't contain any IP SANs" node="node-01"
E0403 00:53:56.973551       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.41:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.41 because it doesn't contain any IP SANs" node="master-01"
E0403 00:53:56.983067       1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.31.52:10250/metrics/resource\": x509: cannot validate certificate for 192.168.31.52 because it doesn't contain any IP SANs" node="node-02"

2. 报错原因

kubelet 的10250端口使用的是https协议,连接需要验证tls证书.

3. 解决方法

Deployment的spec.template.spec.containers.args
大概140行左右

- --kubelet-insecure-tls

“Failed to scrape node“ err=“Get \“https://:10250/metrics/resource\“: x509: cannot validate故障排除_第1张图片

你可能感兴趣的:(kubernetes,metrics-server)