使用kubeadm搭建的k8s,版本是1.14.0, 从github下载的文件搭建了metrics-server, hpa创建好后报错 missing request for cpu
被监控的pod增加了cpu的限制
image: httpd:latest
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
metrics server正常运行,搭建的时候增加了
--kubelet-insecure-tls
--kubelet-preferred-address-types=InternalIP
kubectl 可以得到node和pod的资源使用
[root@temp-01 tmp]# kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
temp-01 79m 3% 982Mi 28%
temp-02 42m 2% 587Mi 16%
temp-03 24m 1% 463Mi 13%
[root@temp-01 tmp]# kubectl top pods
NAME CPU(cores) MEMORY(bytes)
busybox 0m 0Mi
httpd-6c8f566dc8-9mscd 1m 16Mi
httpd-6c8f566dc8-d5lf2 1m 12Mi
httpd-6c8f566dc8-zhwh4 1m 18Mi
httpd-hpatest-7899864fb8-c6dn4 1m 20Mi
hpa和httpd在同一个namspaces内,目前报错 missing request for cpu
[root@temp-01 tmp]# kubectl describe hpa
Name: httpd-hpa
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"httpd-hpa","namespace":"default"...
CreationTimestamp: Thu, 13 Feb 2020 12:25:37 +0800
Reference: Deployment/httpd-hpatest
Metrics: ( current / target )
resource memory on pods: <unknown> / 200Mi
resource cpu on pods (as a percentage of request): <unknown> / 80%
Min replicas: 1
Max replicas: 3
Deployment pods: 1 current / 0 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True SucceededGetScale the HPA controller was able to get the target's current scale
ScalingActive False FailedGetResourceMetric the HPA was unable to compute the replica count: missing request for cpu
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedComputeMetricsReplicas 23m (x12 over 26m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu
Warning FailedGetResourceMetric 72s (x101 over 26m) horizontal-pod-autoscaler missing request for cpu
我怀疑是hpa从metrics server获取资源使用量的时候,使用了https请求,但具体的配置和日志都无从下手,请问如何解决谢谢
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。