List resources in overlay kustomize
Quickly list all resource kinds in a kustomize build
kustomize build ./overlays/prod | grep "^kind:"
more kustomize
all 23 commands →
Apply strategic merge patch
# Add patchesStrategicMerge in kustomization.yaml
Apply strategic merge patch
cat > patch.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 3
template:
spec:
containers:
- name: myapp
resources:
limits:
memory: 512Mi
EOF
echo 'patches:\n- path: patch.yaml' >> kustomization.yaml
Inflate Helm charts in kustomize build
kustomize build --enable-helm ./overlay
Apply a reusable component overlay
cat <<'EOF' >> kustomization.yaml
components:
- ../../components/monitoring
EOF
Copy a field with replacements
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