#Cloud-init
Cloud images expect cloud-init for first-boot configuration: user creation, SSH key injection, package installs, custom commands. The build uses cloud-init to inject its own SSH key, so you must include a cloud_init block for cloud-image sources.
Cloud-init configuration lives in the YAML manifest. Open the editor's YAML tab to add or edit it.
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.