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.
More on Best Practices & Rapid-Fire Commands
What are your top best practices for chart authoring?IntermediateWhat are your top best practices for releasing with Helm in production?IntermediateHow do you set resource requests and limits in a chart without forcing them on users?IntermediateHow would you migrate a release whose stored manifest uses an API removed in the new Kubernetes version?AdvancedRapid fire: commands to inspect a release.BeginnerRapid fire: commands to work with charts locally.Beginner