Kubernetes,一个 VPA 可以管理多个 Cronjobs 吗?
Kubernetes, can one VPA manage multiple Cronjobs?
假设我有这个 VPA 配置文件:
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: vpa-reco
spec:
targetRef:
apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-1
updatePolicy:
updateMode: "Off"
我怎样才能使我的 VPA 目标也成为 CronJob test-autoscaling-2
?
遗憾的是,您不能在单个 VPA
对象中引用多个对象。
如果你像下面这样尝试(在一个 VPA
中有 2 CronJobs
):
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: vpa-reco
spec:
targetRef:
- apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-1
- apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-2
updatePolicy:
updateMode: "Off"
您应该得到类似于以下的错误(部分):
denied the request: json: cannot unmarshal array into Go struct field VerticalPodAutoscalerSpec.targetRef of type v1.CrossVersionObjectReference
要为 test-autoscaling-1
和 test-autoscaling-2
配置 VPA
您需要创建 2 个单独的 VPA
对象像:vpa-reco-1
和 vpa-reco-2
.
从VPA
和CronJob
的角度来谈,在0.7.0
版本中加入了对它的支持。可以在这个特定的发行说明中找到更多信息:
其他资源:
假设我有这个 VPA 配置文件:
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: vpa-reco
spec:
targetRef:
apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-1
updatePolicy:
updateMode: "Off"
我怎样才能使我的 VPA 目标也成为 CronJob test-autoscaling-2
?
遗憾的是,您不能在单个 VPA
对象中引用多个对象。
如果你像下面这样尝试(在一个 VPA
中有 2 CronJobs
):
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: vpa-reco
spec:
targetRef:
- apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-1
- apiVersion: "batch/v1beta1"
kind: CronJob
name: test-autoscaling-2
updatePolicy:
updateMode: "Off"
您应该得到类似于以下的错误(部分):
denied the request: json: cannot unmarshal array into Go struct field VerticalPodAutoscalerSpec.targetRef of type v1.CrossVersionObjectReference
要为 test-autoscaling-1
和 test-autoscaling-2
配置 VPA
您需要创建 2 个单独的 VPA
对象像:vpa-reco-1
和 vpa-reco-2
.
从VPA
和CronJob
的角度来谈,在0.7.0
版本中加入了对它的支持。可以在这个特定的发行说明中找到更多信息:
其他资源: