Configure a Helm post-renderer using kustomize to inject sidecar containers and custom annotations into a third-party chart's output without forking the chart

domain: Helm · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a shell script named kustomize-post-renderer.sh that reads rendered Helm YAML from stdin, writes it to a temporary file, runs kustomize build pointing to a kustomization.yaml that patches the temporary file, and writes the result to stdout
  2. Make the script executable and reference it in helm install or helm upgrade using the --post-renderer flag; Helm pipes its rendered manifests through the script before applying to the cluster
  3. Write a kustomization.yaml that uses strategicMergePatch or JSON 6902 patch files to add a sidecar container to every Deployment in the rendered output, using a wildcard target selector
  4. Add a commonAnnotations block in the kustomization.yaml to inject cost-center and team labels onto every resource regardless of type, avoiding the need to patch each resource individually
  5. Combine the post-renderer with helm --post-renderer-args to pass environment-specific kustomization overlay directories, allowing the same base post-renderer script to apply different patches per environment
  6. Validate the post-renderer output in CI by running helm template with the post-renderer and piping the result to kubeval or kubectl --dry-run=client to catch schema violations before deployment

Known gotchas

Related routes

Use Kustomize components to inject a shared sidecar and ConfigMap across multiple overlays without duplicating patch files
kubectl.docs.kubernetes.io · 6 steps · unrated
Build a Kustomize component that adds a common sidecar container and shared volume across multiple overlays without duplicating the patch in each overlay
kubernetes.io · 5 steps · unrated
Implement a mutating admission webhook to inject a sidecar container into pods
kubernetes.io · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans