Build a Kustomize component that adds a common sidecar container and shared volume across multiple overlays without duplicating the patch in each overlay
Create a Kustomize component directory with a kustomization.yaml that sets kind: Component and includes the sidecar patch as a strategic merge patch or JSON6902 patch file
Define the patch to add the sidecar container spec and any required shared volume to the target Deployment or Pod template, using a match on name or kind
In each overlay kustomization.yaml, add the component under the components field using a relative path to the component directory
Build and inspect each overlay with kustomize build to confirm the sidecar is injected without duplicating the patch definition
Verify that the component-added resources are correctly merged with overlay-specific patches without conflict, adjusting patch order if merge conflicts arise
Known gotchas
Kustomize components differ from bases in that they can be included multiple times across an overlay tree without causing duplicate resource errors; accidentally using a base instead of a component for shared patches causes duplicate resource application
Strategic merge patches in components use the same merge key logic as kubectl apply; if the container name in the patch does not match any existing container, the patch appends a new container silently rather than replacing, which can cause duplicate sidecars
Components are processed after bases and before overlay patches in the kustomize build order; a patch in the overlay that targets the same container the component added must use the correct container name from the component output
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp