Kubernetes HorizontalPodAutoscaler—在另一个命名空间中进行大规模部署
我正在尝试使用自定义度量设置自动缩放 目前,我有:Kubernetes HorizontalPodAutoscaler—在另一个命名空间中进行大规模部署,kubernetes,Kubernetes,我正在尝试使用自定义度量设置自动缩放 目前,我有: 在监视命名空间中运行 在自定义度量命名空间中运行,通过名为api的服务公开 在my namespace命名空间中运行的部署 我在custommetrics命名空间中添加了一个HorizontalPodAutoscaler,目标是我的部署 YAML看起来像: apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: my-deployment-hpa
- 在
命名空间中运行监视
- 在
命名空间中运行,通过名为自定义度量
的服务公开api
- 在
命名空间中运行的部署my namespace
custommetrics
命名空间中添加了一个HorizontalPodAutoscaler
,目标是我的部署
YAML看起来像:
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: my-deployment-hpa
namespace: custom-metrics
spec:
maxReplicas: 10
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: my-deployment
metrics:
- type: Object
object:
metricName: queue_length
targetValue: 1000
target:
apiVersion: extensions/v1beta1
kind: Service
name: api
当我通过kubectl Descripte hpa my deployment hpa-n自定义指标描述HorizontalPodAutoscaler
时,我看到AbleToScale:False
,因为FailedGetScale hpa控制器无法获取目标的当前比例:部署/scale.extensions“my deployment”未找到
Kubernetes是否希望自定义度量API、缩放目标和
HorizontalPodAutoscaler
都存在于同一命名空间中?是的,您要缩放的部署
应该与HorizontalPodAutoscaler
对象位于同一命名空间中
以下是库伯内特家族的一段摘录:
名称空间提供名称的作用域。需要对资源的名称进行修改
在命名空间内唯一,但不跨命名空间
HorizontalPodAutoscaler
对象的Namespace
值是提供有关要扩展的部署命名空间的信息的唯一方法。此问题的增强版本:适配器是否也必须位于同一命名空间中?