【发布时间】:2017-12-14 16:58:40
【问题描述】:
我不明白为什么我的水平 pod 自动缩放器无法从我的部署中读取 CPU 使用情况统计信息。
关于我的环境:
- kubernetes 1.8.4 on AWS,使用 k8s 部署
- 3 个节点和 1 个主节点
- heapster 已安装(版本 1.5.0)并且正在工作(它在 influxdb 中写入数据,我可以在 grafana 中看到它)
以下是活动 HPA 的列表:
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
api Deployment/api <unknown> / 70% 2 5 0 5h
web Deployment/web 0% / 70% 2 5 2 22h
如您所见,只有一个 HPA 可以检测部署的资源使用情况。
web 部署(有效的):
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
name: web
name: web
namespace: default
spec:
replicas: 1
selector:
matchLabels:
name: web
template:
metadata:
labels:
name: web
spec:
containers:
- image: <private repository image path>
imagePullPolicy: IfNotPresent
name: node
ports:
- containerPort: 3000
protocol: TCP
resources:
limits:
cpu: 200m
memory: 200M
requests:
cpu: 200m
memory: 200M
不起作用的api部署:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
name: api
name: api
namespace: default
spec:
replicas: 1
selector:
matchLabels:
name: api
template:
metadata:
labels:
app: api
spec:
containers:
image: <private repository image path>
imagePullPolicy: IfNotPresent
name: node
ports:
- containerPort: 3000
protocol: TCP
resources:
limits:
cpu: 250m
memory: 200M
requests:
cpu: 250m
memory: 200M
网络 HPA(有效的):
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: web
namespace: default
spec:
maxReplicas: 5
minReplicas: 2
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: web
targetCPUUtilizationPercentage: 70
api HPA(不起作用的那个):
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: api
namespace: default
spec:
maxReplicas: 5
minReplicas: 2
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: api
targetCPUUtilizationPercentage: 70
正如您所见,部署和 hpa 几乎相同,这就是为什么我无法弄清楚为什么只有一个有效。 任何解决此问题的帮助将不胜感激
编辑
我只是尝试删除正在工作的 hpa 并重新应用它,但它也不起作用。这让我认为这是heapster的问题。 我更新到最新的 heapster 版本 (1.5.0) 但仍然没有运气。
【问题讨论】:
标签: kubernetes