I have a cluster with Cluster Autoscaler activated and HPA for one of my deployments.
This is the HPA definition:
apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: hpa-resource-metrics-cpu spec: scaleTargetRef: apiVersion: apps/v1 kind: ReplicationController name: hello-hpa-cpu minReplicas: 1 maxReplicas: 10 metrics: - type: Resource resource: name: cpu targetAverageUtilization: 50
Now in a situation where my cluster is being used very lightly, that means this deployment will only have 1 available replica.
And since the cluster is not under high usage, it could be the case that the node containing that replica is scheduled for deletion (downscaling).
I don’t want that to happen, since this would make my deployment have a downtime (when the cluster node is deleted, the only replica for the deployment is deleted as well, so it needs to be rescheduled in a new pod).
From this issue: kubectl drain leads to downtime even with a PodDisruptionBudget · Issue #48307 · kubernetes/kubernetes · GitHub, it seems that Pod Disruption Budgets are not applicable to deployments with only 1 replica.
So the only solution to my problem would be to have
minReplicas set to 2?
Or is there something else I could do to prevent this downtime, and still let
minReplicas as 1?