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

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.

All Helm questions Roadmap: Helm

More on Best Practices & Rapid-Fire Commands