Copy a field with replacements kustomize
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
more kustomize
all 23 commands →
Inline patch with target selector
cat <<'EOF' >> kustomization.yaml
patches:
- target: {kind: Deployment, labelSelector: app=api}
patch: |-
- op: replace
path: /spec/replicas
value: 3
EOF
Pin image by digest and rename
kustomize edit set image app=registry.example.com/app@sha256:<id>
Secret generator without hash suffix
cat <<'EOF' >> kustomization.yaml
secretGenerator:
- name: db-creds
literals: [PASSWORD=s3cr3t]
generatorOptions:
disableNameSuffixHash: true
EOF
Register CRD OpenAPI for merge keys
cat <<'EOF' >> kustomization.yaml
openapi:
path: crd-schema.json
EOF
Build kustomization
kustomize build ./overlays/prod