How to setup cloud-init in prxmox ve
Cloud-init can help us to deploy or change settings of linux virutal machine via api or manually by ourself.
There are two ways to setup cloud-init: command line or change settings in GUI.
Option 1: Download cloud-init image and setup with shell
Please reference my blog Build Ubuntu 18.04 server with cloudinit support
Option 2: Manually Setup cloud-init
We can do this with 2 steps. 1st step is to install linux(centos,debian,ubunt etc).
Install a linux
I think this step is easy.
Install and setup cloud-init
After installed an linux.
debian/ubuntu
|
|
RHEL/Centos
|
|
Create a cloud-init boot disk
- shutdown the vm
shutdown -h now
- select the vm in PVE web GUI.
- Then click
Hardware
. - click
Add
button and selectCloudinit drive
. - Select Storage on the storage.
- Then Click
Create
to create cloudinit drive. - Right click the VM and click
start
to boot the VM.
Change some settings
After setup cloud-init, Seem like it automatically reset your sourelist to default settings and we couldn’t login via ssh with password.
Enable password authentication
|
|
Permit root can loing with password
|
|
Change machine-id
|
|
change hostname with ubuntu 18.04
|
|
Permit modified sourelist
|
|
Then you can change sourelist without worried about the sourcelist will be overwriten by cloud-init