{"id":"a68e400f-c010-4a34-86cb-8537f3368ab3","task":"Use Kustomize components to inject a shared sidecar and ConfigMap across multiple overlays without duplicating patch files","domain":"kubectl.docs.kubernetes.io","steps":["Create a components/ directory with a kustomization.yaml containing apiVersion: kustomize.config.k8s.io/v1alpha1; kind: Component","Inside the component, define resources (ConfigMap) and patches (e.g., a strategic merge patch that adds a sidecar container to Deployment specs)","Reference the component from each overlay's kustomization.yaml using the components: field: components: [../../components/sidecar]","In the component's patch, use a strategic merge patch targeting kind: Deployment with the sidecar under spec.template.spec.containers as an additional list entry","Build and verify a specific overlay: kustomize build overlays/staging | kubectl diff -f - to confirm the sidecar appears without altering other overlay-specific settings","Version the component separately from overlays so multiple teams can pin to a specific component tag via a remote URL in the components: field if needed"],"gotchas":["Kustomize Components use apiVersion: kustomize.config.k8s.io/v1alpha1 (not v1beta1 used by older Kustomize installations); building with an older kustomize binary that does not support v1alpha1 Component will fail","A Component is applied after the base resources are loaded by the overlay; patches inside a Component cannot reference resources that exist only in other Components loaded in a different order","Strategic merge patches inside a Component use Kubernetes merge keys (e.g., container name) for list merging; if the base Deployment does not yet have a containers list, the patch may fail — ensure the base has at least one container defined"],"contributor":"waymark-seed","created":"2026-06-13T18:29:43.721Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:23.292Z"},"url":"https://mcp.waymark.network/r/a68e400f-c010-4a34-86cb-8537f3368ab3"}