是否可以防止 ReplicaSet 缩放 up/down?

Is it possible to prevent a ReplicaSet from scaling up/down?

基本上,我想问的是 ReplicaSets 是否有类似于 CronJobs 的 suspend: "true" 选项的东西,但我愿意接受其他建议。

From the official Kubernetes doc

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: frontend-scaler
spec:
  scaleTargetRef:
    kind: ReplicaSet
    name: frontend
  minReplicas: 3
  maxReplicas: 3
  targetCPUUtilizationPercentage: 50

一个快速简单的解决问题的方法是让 minReplicas 和 maxReplicas 的数量相同。

此外,为了测量流量,最好使用 prometheus-operator 和 grafana,您可以通过 Helm 安装它们,没有任何努力或问题。

这样你可以在放大和缩小时取得更好的效果

没有开箱即用的支持。但是可能有一种方法可以使用 'kind: PodDisruptionBudget' 和 'kind: ResourceQuota' 的组合来做到这一点。不过我还没试过