Prerequisites
- Kubernetes cluster or local setup (e.g., Docker Desktop, Minikube)
kubectlv1.18+- Kustomize v3.2+ (bundled with
kubectlsince v1.14)
1. Replace the Image Name
Suppose you have a Deployment manifest (deployment.yaml) deploying an NGINX container:
nginx for haproxy, create a kustomization.yaml in the same directory:
nginx image reference and replace it with haproxy. The rendered Deployment becomes:
The
name field under images matches the image name from your resources, not the container name in the Pod spec.2. Change Only the Image Tag
If you want to keepnginx but bump its version tag to 2.4, specify newTag instead:
kustomize build ., the Deployment’s container image updates to:
3. Combine Image Name and Tag Changes
You can simultaneously override both the repository and the tag:haproxy:2.4:
Image Transformer Fields
| Field | Description | Example |
|---|---|---|
| name | Original image name in your resources | nginx |
| newName | Replacement image repository or name | haproxy |
| newTag | New version tag for the image | 2.4 |
Omitting both
newName and newTag in an images entry has no effect. Ensure at least one property is set.