发生了什么?
HPA目标状态未知。
❯ k get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
{{name}} Deployment/{{deployment}} <unknown>/50% 1 10 1 105m
但是,部署和pod资源设置是正常的。
kubectl get -o json deployment {{deployment}} | jq '.spec.template.spec.containers[].resources'
{
"limits": {
"cpu": "1",
"memory": "1500Mi"
},
"requests": {
"cpu": "500m",
"memory": "1000Mi"
}
}
metric-server日志找到了。
hpa设置正常。
hpa.yaml
apiVersion: v1
items:
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
labels:
hpa.test: hpa
name: {{name}}
namespace: {{namespace}}
spec:
maxReplicas: 10
metrics:
- resource:
name: cpu
target:
averageUtilization: 50
type: Utilization
type: Resource
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{deployment name}}
(cronjobs没有hpa.test: hpa
标签,但deployment有hpa.test: hpa
标签)
HPA生成一些日志
k describe hpa
...
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedGetResourceMetric 49m (x13 over 101m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}} of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 39m (x72 over 110m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}} of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 34m (x7 over 99m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}}of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 29m (x2 over 82m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}}of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 19m (x4 over 63m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}} of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 14m (x5 over 85m) horizontal-pod-autoscaler failed to get cpu utilization: missing request for cpu in container {{cronjob container}} of Pod {{cronjob pod name}}
Warning FailedGetResourceMetric 4m50s (x167 over 106m) horizontal-pod-autoscaler (combined from similar
有很多pod的状态是"Completed"
❯ k get po
NAME READY STATUS RESTARTS AGE
{{deployment name}} 1/1 Running 0 19m
{{cronjob pod }} 0/1 Completed 4 7h43m
{{cronjob pod }} 0/1 Completed 3 5h43m
{{cronjob pod }} 0/1 Completed 3 163m
{{cronjob pod }} 0/1 Completed 4 6h53m
所以,我认为hpa不仅读取deployment的指标,还读取cronjob的指标。
你期望发生什么?
我期望hpa能表达一个精确的数字。
我们如何尽可能最小精确地重现它?
一起部署deployment和cronjob,并将cronjob置于已完成状态。
我们需要了解其他信息吗?
- 无响应*
Kubernetes版本
v1.28.5
云提供商
AWS EKS
OS版本
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
6条答案
按热度按时间1bqhqjot1#
这个问题目前正在等待分类。
如果SIG或子项目确定这是一个相关的问题,他们将通过应用
triage/accepted
标签并提供进一步的指导来接受它。组织成员可以通过在评论中写入
/triage accepted
来添加triage/accepted
标签。有关使用PR评论与我互动的说明,请查看here。如果您对我的行为有任何问题或建议,请针对kubernetes/test-infra仓库提出一个问题。
j5fpnvbx2#
/area autoscaler
ilmyapht3#
@AmarNathChary: 标签
area/autoscaler
无法应用,因为仓库中没有它们。对此的回应:
/area autoscaler
使用 PR 评论与我互动的说明已提供。如果您对我的行为有任何疑问或建议,请针对 kubernetes/test-infra 仓库提交一个问题。
mfuanj7w4#
/sig autoscaling
hof1towb5#
Kubernetes项目目前缺乏足够的贡献者来充分应对所有问题。
此机器人根据以下规则对未分类的问题进行分级处理:
lifecycle/stale
应用后的90天内无活动,将应用lifecycle/stale
lifecycle/stale
应用后的30天内无活动,将应用lifecycle/rotten
lifecycle/rotten
应用后的30天内无活动,将关闭该问题您可以:
/remove-lifecycle stale
标记此问题为新鲜/close
关闭此问题请将反馈发送至sig-contributor-experience@kubernetes/community。
/lifecycle stale
hs1ihplo6#
Kubernetes项目目前缺乏足够的活跃贡献者来充分应对所有问题。
此机器人根据以下规则对未分类的问题进行分级处理:
lifecycle/stale
应用后的90天内无活动,将应用lifecycle/stale
lifecycle/stale
应用后的30天内无活动,将应用lifecycle/rotten
lifecycle/rotten
应用后的30天内无活动,将关闭该问题您可以:
/remove-lifecycle rotten
标记此问题为新鲜/close
关闭此问题请将反馈发送至sig-contributor-experience@kubernetes/community。
/lifecycle rotten