multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Can I pass network configuration using cloud-init?

Open codecowboy opened this issue 10 months ago • 2 comments

The cloud-init docs state:

You can pass the user-data file to Multipass and launch a Bionic instance named test-vm with the following command:

multipass launch bionic --name test-vm --cloud-init user-data
Multipass will validate the user-data configuration file before starting the VM. This breaks all cloud-init configuration formats except the user-data cloud-config.

But if I try to include network config in a user-data file I get:

Error: Cloud config schema errors: network: Additional properties are not allowed ('network' was unexpected),

I would be grateful if someone could let me know whether what I am trying to do is even possible with the multipass implementation of cloud-init? Does the statement 'this breaks all cloud-init configuration formats except...' mean that this isn't possible?

My use case is that I am trying to use cloud-init with ubuntu on a raspberry pi and am having issues with network configuration. I decided to try multipass to see if I could debug the issue locally without juggling sd cards. I'm finding all the docs to be pretty vague and unhelpful.

I also tried providing a list of files to multipass (a separate network-config file) but this also didn't work.

I'm guessing that the networking side of multipass vms is baked in to the application to enable host->vm networking but would be grateful if someone could confirm.

codecowboy avatar Feb 21 '25 15:02 codecowboy

Hi @codecowboy,

Multipass should work with any user-data module described by the cloud-init docs. Since cloud-init handles network configuration and user-data separately I don't believe it is possible. As you guessed, the networking side is mostly baked into the application.

Sploder12 avatar Feb 21 '25 16:02 Sploder12

@codecowboy If you want to know how I configure network inside multipass using cloud-init, take a look at my code:

https://github.com/Fred78290/autoscaled-masterkube-multipass/blob/main/bin/plateform/multipass/plateform.sh

Fred78290 avatar Mar 01 '25 09:03 Fred78290

This should be better documented.

ricab avatar Sep 12 '25 19:09 ricab