gpt4 book ai didi

docker - kubernetes hpa 获取不到cpu消耗

转载 作者:行者123 更新时间:2023-12-01 01:59:37 25 4
gpt4 key购买 nike

我正在尝试配置 kubernetes 水平 pod 自动缩放。我部署的定义是 here .

我开始 heapster 部署和 heapster 服务,如下所示:

# kubectl run heapster --namespace=kube-system --image=gcr.io/google_containers/heapster:v1.0.2 --command -- /heapster --source=kubernetes:http://192.168.122.159:8080?inClusterConfig=false --sink=log
# kubectl expose deployment heapster --port=80 --target-port=8082 --name=heapster --namespace=kube-system

hpa 是这样创建的:
# kubectl autoscale deployment nginx-rc --max=5 --cpu-percent=25

heapster 似乎运行良好。这是 logs .

毕竟,hpa 没有收到任何关于 CPU 利用率的数据。
# kubectl describe hpa
Name: nginx-rc
Namespace: default
Labels: <none>
Annotations: <none>
CreationTimestamp: Sat, 04 Jun 2016 07:23:03 -0400
Reference: Deployment/nginx-rc/scale
Target CPU utilization: 25%
Current CPU utilization: <unset>
Min replicas: 1
Max replicas: 5
Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
9m 7s 22 {horizontal-pod-autoscaler } Warning FailedGetMetrics failed to get CPU consumption and request: metrics obtained for 0/1 of pods
9m 7s 22 {horizontal-pod-autoscaler } Warning FailedComputeReplicas failed to get CPU utilization: failed to get CPU consumption and request: metrics obtained for 0/1 of pods

Controller 管理器日志有一个重复的行:
Jun 04 07:21:33 master kube-controller-manager[8202]: W0604 07:21:33.079677    8202 horizontal.go:108] Failed to reconcile nginx-rc: failed to compute desired number of replicas based on CPU utilization for Deployment/default/nginx-rc: failed to get CPU utilization: failed to get CPU consumption and request: metrics obtained for 0/1 of pods

有人可以在这里指出问题的性质吗?

最佳答案

最有可能的问题是您没有在集群中运行 DNS。

HPA 目前使用 heapster 服务名称来读取指标。您已正确创建它,但 HPA Controller 无法将服务名称解析为 IP 地址,因为您的集群中没有 DNS。

我创建了问题 https://github.com/kubernetes/kubernetes/issues/27044有更多信息性事件可以帮助用户/管理员更好地理解问题。

关于docker - kubernetes hpa 获取不到cpu消耗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37631008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com