Question

I'm currently dealing with CoreOS, and so far I think I got the overall idea and concept. One thing that I did not yet get is execution of cloud-init.

I understand that cloud-init is a process that does some configuration for CoreOS. What I do not yet understand is…

  • When does CoreOS run cloud-init? On first boot? On each boot? …?
  • How does cloud-init know where to find its configuration data? I've seen that there is config-drive and that totally makes sense, but is this the only way? What exactly is the role of the user-data file? …?
Was it helpful?

Solution

CoreOS runs cloudinit a few times during the boot process. Right now this happens at each boot, but that functionality may change in the future.

The first pass is the OEM cloud-init, which is baked into the image to set up networking and other features required for that provider. This is done for EC2, Rackspace, Google Compute Engine, etc since they all have different requirements. You can see these files on Github.

The second pass is the user-data pass, which is handled differently per provider. For example, EC2 allows the user to input free-form text in their UI, which is stored in their metadata service. The EC2 OEM has a unit that reads this metadata and passes it to the second cloud-init run. On Rackspace/Openstack, config-drive is used to mount a read-only filesystem that contains the user-data. The Rackspace and Openstack OEMs know to mount and look for the user-data file at that location.

The latest version of CoreOS also has a flag to fetch a remote file to be evaluated for use with PXE booting.

The CoreOS distribution docs have a few more details as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top