Search code examples
cloud-initgoogle-container-os

How do I rerun cloud-init without shutting down?


Is there a recommended way of running cloud-init on Google Container-Optimized OS once the instance is up and have it fetch the latest metadata?

So far, I have been blowing away the /var/lib/cloud/instances directory and rerunning, but that seems hacky.


Solution

  • On Container-Optimized OS images, there is /usr/share/cloud/rerun-cloudinit.sh that you can run. It will re-fetch the latest metadata and run all required cloud-init steps.