Copy a field with replacements
modern: replacements: copies a field cross-resource, replaces deprecated vars:
cat <<'EOF' >> kustomization.yaml
replacements:
- source: {kind: ConfigMap, name: cfg, fieldPath: data.host}
targets:
- select: {kind: Deployment}
fieldPaths: [spec.template.spec.containers.0.env.0.value]
EOF
- tool
- kustomize23 commands
More kustomize commands
-
cat <<'EOF' >> kustomization.yaml patches: - target: {kind: Deployment, labelSelector: app=api} patch: |- - op: replace path: /spec/replicas value: 3 EOFJSON6902 patch applied to all matching targets, no separate file
-
kustomize edit set image app=registry.example.com/app@sha256:<id>Pin by immutable digest; newName+digest also settable in images: block
-
cat <<'EOF' >> kustomization.yaml secretGenerator: - name: db-creds literals: [PASSWORD=s3cr3t] generatorOptions: disableNameSuffixHash: true EOFnote: disableNameSuffixHash keeps stable name but breaks rollout-on-change
-
cat <<'EOF' >> kustomization.yaml openapi: path: crd-schema.json EOFTeach kustomize CRD merge/list semantics so patches merge correctly
-
kustomize build ./overlays/prodRender all manifests for an overlay to stdout