CKAD field manual
k8s kustomize YAML example
A kustomization.yaml lists files, then overlays namespace, replicas, images. No templates.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: app
resources:
- deploy.yaml
- svc.yaml
replicas:
- name: web
count: 3
images:
- name: nginx
newTag: "1.28"
commonLabels:
env: exam
kubectl apply -k .
kubectl kustomize .
kubectl delete -k .
Fields
- resources
- Paths relative to this file. The file must be named kustomization.yaml.
- replicas
- name is the Deployment name, not a label.
- images
- name is the image in the YAML, no tag. newTag replaces the tag.
- kubectl apply
- -k, not -f. apply -f . ignores kustomization.yaml.
Watch
- The file must be named kustomization.yaml (or .yml). resources: paths are relative to that file.
- replicas.name is the Deployment name, not a label. images.name is the image name in the YAML, no tag.
- kubectl apply -f . ignores kustomization.yaml. You need -k.
Official docs Kustomize