I'm currently developing my ci/cd pipeline via 'gitHub' actions.
My k8s deployments being managed by 'helm' and runs on GKE and my 'images' stored in 'gcp'
I've successfully manages to build and deploy a new image via 'gitHub' actions, and now I've
would like that one of the pods will fetch the latest version after the image was deployed to 'gcp'.
As I understand the current flow is to update the helm chart version after creating the new image and run 'helm upgrade
' from k8s (am I right?), but currently I would like to skip the helm
versioning part and just force the pod to get the new image.
Until now to make it work, after I was creating the new image I was simply deleting the pod and because the deployment is exists the pod was recreated, but my questions is:
Should I do the same from my 'CI' pipeline(deleting the pod) or there is another way doing that?
0
votes
1 Answers
1
votes
Use kubectl rollout
If you are using latest
tag for image and imagePullPolicy
is set as Always
, you can try kubectl rollout
command to fetch the latest built image.
But latest
image tag is not recommended for the prod deployment, because you cannot ensure the full control of the deployment version.
Update image tag in values.yaml file
If you have some specific reasons to avoid chart version bump, you can only update the values.yaml file and try helm upgrade
command with the new values.yaml file which has the new image tag. In this case, you have to use specific image tags, not latest
.
If you have to use latest
image tag, you can use sha256
value of the image as the tag in the values.yaml file.
imagePullPolicy
ofAlways
but it is not desirable to do so since the image size could be large and pulling at each restart could be costly. – Krishna Chaurasia