1

I have two applications (identity and API) in a single repository. I have set up in a CI/CD pipeline to deploy them to kubernetes; the images are building fine.

How can I structure the kustomization.yaml file to deploy the image edits without updating the images with wrong data? I noticed the two apps are pointing to the same image.

jobs:          
  identity-job:
   ...                                                                        
   ./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=gcr.io/$PROJECT_ID/$IDSIMAGE:$GITHUB_SHA
   ./kustomize build . | kubectl apply -f -

   api-job:
   ...                                                                        
   ./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=gcr.io/$PROJECT_ID/$APIIMAGE:$GITHUB_SHA
   ./kustomize build . | kubectl apply -f -
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Hakeem Oriola
  • 11
  • 1
  • 3
  • So the manifests are all referencing the same image? But you are build two separate images? Why not also store two separate images in the manifests so you can `kustomize edit set image` both of them separately – Waaghals Apr 14 '23 at 18:28

1 Answers1

0

Should you need to update the kustomization.yaml file? What about to directly edit the deployment, like:

kubectl -n <namespace-name> set image <deployment-name> <pod-name>=<container-image-name>

as example

kubectl -n identity-job set image deployment/identity-job job=gcr.io/$PROJECT_ID/$IDSIMAGE:$GITHUB_SHA

Matteo
  • 37,680
  • 11
  • 100
  • 115