#Cloud-init
Cloud images use cloud-init for first-boot setup, including users, SSH keys, packages, and commands. The build uses it to add its SSH key, so cloud-image sources must include a cloud_init block.
Cloud-init is configured in the manifest's YAML tab.
Minimal:
cloud_init:
user_data: |
#cloud-config
ssh_authorized_keys: []
The empty ssh_authorized_keys: [] is fine; the build appends its own key. You can use any other cloud-config directives:
cloud_init:
user_data: |
#cloud-config
ssh_authorized_keys: []
timezone: America/Chicago
package_update: true
packages:
- htop
- vim
runcmd:
- echo "first boot" > /var/log/firstboot
write_files:
- path: /etc/myapp/config
content: |
key=value
If you would rather keep cloud-config in a ConfigMap, use user_data_from:
cloud_init:
user_data_from:
config_map_ref:
name: my-cloud-config
key: user-data
For network-data (rare; needed if you are disabling the cloud's default network setup), use cloud_init.network_data.
Do not put long-running setup in runcmd. Use shell provisioners instead. cloud-init is for boot-time prep; provisioners are for the actual build work.