Add recommendation for Deployment when HPA is enabled
* Advertise that we need to remove `spec.replicas` when a Horizontal Pod Autoscaler is active to prevent unnecessary changes in Pod counts during Deployment object changes * Make note that a Deployment that has this value set behave awkwardly if a Deployment is scaled manually outside of the Deployment object Signed-off-by: John T Skarbek <jtslear@gmail.com>
This commit is contained in:
@@ -1070,6 +1070,18 @@ allowed, which is the default if not specified.
|
||||
|
||||
`.spec.replicas` is an optional field that specifies the number of desired Pods. It defaults to 1.
|
||||
|
||||
Should you manually scale a Deployment, example via `kubectl scale deployment
|
||||
deployment --replicas=X`, and then you update that Deployment based on a manifest
|
||||
(for example: by running `kubectl apply -f deployment.yaml`),
|
||||
then applying that manifest overwrites the manual scaling that you previously did.
|
||||
|
||||
If a [HorizontalPodAutoscaler](/docs/tasks/run-application/horizontal-pod-autoscale/) (or any
|
||||
similar API for horizontal scaling) is managing scaling for a Deployment, don't set `.spec.replicas`.
|
||||
|
||||
Instead, allow the Kubernetes
|
||||
{{< glossary_tooltip text="control plane" term_id="control-plane" >}} to manage the
|
||||
`.spec.replicas` field automatically.
|
||||
|
||||
### Selector
|
||||
|
||||
`.spec.selector` is a required field that specifies a [label selector](/docs/concepts/overview/working-with-objects/labels/)
|
||||
|
||||
Reference in New Issue
Block a user