Interview Prep/Helm/Best Practices & Rapid-Fire Commands

How do you keep an HPA and Helm from fighting over `replicas`?

AdvancedConceptBest Practices & Rapid-Fire Commands
Answer

If the Deployment template always sets replicas, every helm upgrade resets the count to the chart value, undoing the HPA's scaling until it reacts again (a capacity dip during deploys). Omit replicas when autoscaling is enabled:

spec:
  {{- if not .Values.api.autoscaling.enabled }}
  replicas: {{ .Values.api.replicaCount }}
  {{- end }}

With Argo CD, also add ignoreDifferences on /spec/replicas if an older revision set it. Under server-side apply, field ownership makes this cleaner.

All Helm questions Roadmap: Helm

More on Best Practices & Rapid-Fire Commands