metrics-server 新增hostNetwork: true #1418
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
今天,当我使用kubectl top nodes 来检查节点负载时,我得到了一个错误:"error: Metrics API not available."
我使用了kubectl logs -f -n kube-system metrics-server-xxxxxx 和 systemctl status kube-apiserver-Service -l 查看日志,发现有很多访问失败的记录。
起初我一直认为rbac设置不正确。
经过仔细研究,我们发现是metrics-server端口不可访问。kube-apiserver和metrics-server都会报告如下错误。
909 available_controller. go:460] v1beta1.metrics.k8s. io failed with: failing or missing response from https://172.20.196.137:4443/apis/metrics.k8s.io/v1beta1: Get "https://172.20.196.137:4443/apis/metrics.k8s. io/v1beta1": context deadline exceeded
最后,我修改metrics server启动YAML文件:deployment.spec.template.spec.hostNetwork: true
发现问题已经解决。