【发布时间】:2016-10-04 12:02:29
【问题描述】:
我正在尝试配置 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
控制器管理器日志有一个重复行:
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 服务器了吗?
-
没有。为什么这里需要 DNS 服务器?
-
如果你
describeheapster rc,你可以看到它设置了http:kubernetes.default。就我而言,是有错误 -
heapster 是一个部署,而不是 rc。这是描述向我展示的内容:``` 名称:heapster 命名空间:kube-system CreationTimestamp:星期六,2016 年 6 月 4 日 07:11:31 -0400 标签:run=heapster 选择器:run=heapster 副本:1 更新 |共 1 个 | 1 个可用 | 0 不可用 StrategyType:RollingUpdate MinReadySeconds:0 RollingUpdateStrategy:1 最大不可用,1 最大激增 OldReplicaSets:
NewReplicaSet:heapster-3915811212(1/1 副本创建)没有事件。 ```
标签: docker kubernetes autoscaling