A developer hardcoded `namespace: production` in every template. What is wrong and how do you fix it?
BeginnerScenarioChart Design & Authoring
Answer
Situation read → The chart can no longer be installed into any other namespace; helm install -n staging would still create objects in production, while the release record lands in staging.
What I'd do →
- Remove
metadata.namespacefrom templates, or set it to{{ .Release.Namespace }}for clarity. - Replace hardcoded namespaces in DNS names with
{{ .Release.Namespace }}(api.{{ .Release.Namespace }}.svc.cluster.local). - Add a CI check:
helm template x ./chart -n ci-test | grep -E '^\s+namespace:' | grep -v ci-testmust be empty.
Why → The namespace is a deploy-time decision; charts must stay portable.
Interview tip → Note that release records and objects in different namespaces confuse helm uninstall.
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?IntermediateChanging 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?IntermediateHow do you make a chart work for both a stateless API and a worker that has no Service?Intermediate