How do you make a chart work for both a stateless API and a worker that has no Service?
IntermediateScenarioChart Design & Authoring
Answer
Situation read → Same code base, two run modes; the worker must not get a Service, Ingress or HTTP probes.
What I'd do →
- Model components in values:
api.enabled,worker.enabled, each with image args, replicas and resources. - Render the Service and Ingress only for
api, wrapping each template in{{- if .Values.api.enabled }}. - Give the worker exec or no probes, and its own
app.kubernetes.io/component: workerselector label. - Share image settings through a common
imageblock with per-component overrides.
Why → Components keep selectors distinct, so the API Service never routes to worker pods.
Interview tip → Highlight the component label in selectors as the thing that keeps them separate.
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