Cloud-init fields for VM applications

Use the following reference tables to configure cloud-init volumes and directives in KubeVirt VirtualMachine YAML for Red Hat Edge Manager VM applications.

Cloud-init volume fields

The following table lists the cloud-init fields available in the KubeVirt VirtualMachine YAML volume specification.

Table 1. Cloud-init volume fields
Field Volume type Description Applicable in Red Hat Edge Manager

userData

cloudInitNoCloud, cloudInitConfigDrive

Inline cloud-config YAML. Must start with #cloud-config.

Yes

userDataBase64

cloudInitNoCloud, cloudInitConfigDrive

Base64-encoded cloud-config YAML. Use this field when the YAML contains special characters.

Yes

networkData

cloudInitNoCloud, cloudInitConfigDrive

Inline network configuration YAML.

Yes

networkDataBase64

cloudInitNoCloud, cloudInitConfigDrive

Base64-encoded network configuration YAML.

Yes

secretRef

cloudInitNoCloud, cloudInitConfigDrive

Reference to a Kubernetes Secret containing user-data.

No (edge devices do not have a Kubernetes Secret store)

Common cloud-config directives

The following table lists the cloud-config directives most commonly used in Red Hat Edge Manager VM applications.

Table 2. Common cloud-config directives
Directive Description

user

Sets the default user name for the VM guest. When omitted, cloud-init uses the default user defined by the guest image (for example, cloud-user for Red Hat Enterprise Linux cloud images or fedora for community Fedora container disk images).

ssh_authorized_keys

A list of SSH public keys to add to the default user’s authorized_keys file. When user: is omitted, keys are added to the guest image default user.

password

Sets the password for the default user when user: is omitted. The Red Hat Edge Manager guided form uses this directive together with ssh_pwauth and chpasswd.

chpasswd

Configures password settings. Set expire: false to prevent password expiration on first login.

ssh_pwauth

Set to true to enable SSH password authentication.

users

A list of user definitions to create on the VM guest. Each entry can specify name, groups, sudo, shell, and ssh_authorized_keys. Use this directive to create a custom login account instead of using the image default user. For an example, see Configure cloud-init for a VM application in the Additional resources section.

packages

A list of packages to install on first boot.

write_files

A list of files to write to the VM guest filesystem. Each entry specifies path, content, permissions, and owner.

runcmd

A list of shell commands to run on first boot, after package installation.