The chart must support an optional sidecar (log shipper) that some environments need. How do you add it cleanly?
IntermediateScenarioChart Design & Authoring
Answer
Situation read → Optional container, with its own image, resources and config.
What I'd do →
- Add
logShipper.enabled,logShipper.image,logShipper.resourcesin values. - In the pod spec, render the container inside
{{- if .Values.logShipper.enabled }}, plus its ConfigMap and sharedemptyDirvolume. - Alternatively offer generic
extraContainers(rendered withtpl (toYaml .Values.extraContainers) .) for any sidecar. - Consider native sidecars (init container with
restartPolicy: Always, Kubernetes 1.29+) so it starts before and stops after the app.
Why → A dedicated block for common sidecars, plus a generic escape hatch for rare ones.
Interview tip → Mentioning native sidecars shows you track current Kubernetes features.
More on Chart Design & Authoring
Your team has 15 near-identical YAML folders, one per microservice per environment. How do you introduce Helm?BeginnerShould you build one generic chart for all microservices or one chart per service?IntermediateA developer hardcoded `namespace: production` in every template. What is wrong and how do you fix it?BeginnerChanging a ConfigMap value in the chart does not restart the pods, so the app keeps old config. What do you change?IntermediateYou need the same chart to support both Ingress and Gateway API HTTPRoute. How do you design it?IntermediateYour chart's Deployment template has grown to 300 lines of nested `if`s. How do you clean it up?Intermediate