I have a instance on GCP running in Instance Group with a Container-Optimized OS using a single image hosted on GCR.
I want to pull a new image to GCP, and refresh the instance image with that new image. I'm building and pushing over GitHub Actions and can call some gcloud
command inside the CI workflow.
I want to say "hey Instance Group, do pull again the container imagens". It would be good to do this keeping the service running.
What should be the best approach to do that? What full gcloud
command to do that?
The steps are:
Create an instance template:
gcloud compute instance-templates create-with-container [TEMPLATE_NAME] --container-image [DOCKER_IMAGE]
Update the MIG:
gcloud compute instance-groups managed rolling-action start-update [MIG_NAME] --version template=[TEMPLATE_NAME]
You can read more about configuring the available options for your update here.