How do you set resource requests and limits in a chart without forcing them on users?
IntermediateConceptBest Practices & Rapid-Fire Commands
Answer
Provide sensible defaults in values.yaml and render them with toYaml, so users can override or null out individual fields:
# values.yaml
api:
resources:
requests: { cpu: 100m, memory: 128Mi }
limits: { memory: 256Mi }
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
Many teams set memory limits but omit CPU limits to avoid CFS throttling; the chart should not hardcode that opinion, only default it.
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 keep an HPA and Helm from fighting over `replicas`?AdvancedHow 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