LXC containers, cloud-init, and hook scripts?

steevestroke

Member
May 29, 2022
36
19
13
Howdy, folks.

Can I get an affirm on this? Proxmox does not support cloud-init for LXC containers, correct? I'm looking at the API docs and they seem to suggest as much as the endpoints and parameters available on the QEMU VM API are not reflected on the container endpoints.

Also, I did some digging into hook scripts as possible alternative. The docs are a bit thin on this feature but it looks to me like hook scripts execute on the Proxmox server for various lifecycle events for both containers and VMs however they **do not** execute in the container or VM. They execute in VE itself. So this is not an escape hatch for lack of cloud-init in containers.

If I have all of this correct, how they do people do deploy-time adjustments to their containers? Most of the time, I would think, there are going to be deploy-time things that need to be adjusted which cannot be pre-baked into custom container images.

Very interested to hear what people have to share.
 
Hmm...

I was hoping to be able to bootstrap these things from Terraform and so that would require the necessary pieces being available via the PVE API. I'll probably stick with VMs for now. Kinda disappointing.

Feels like I might have some luck running Nomad on PVE w/ Clients w/ nested virtualization and just coming at the container-y workloads that way.
 
I've since rotated to deploying Nomad control plane and workers on TrueNAS SCALE because the OpenTofu Provider is more complete for that platform. Nomad does have the ability to schedule LXC containers and so I may loop back to this at some point with Nomad spinning the Proxmox LXC containers. It looks like the options for post-deploy config/mutation are more flexible by having Nomad in the mix. Around the horn for sure but my need for LXC is rather limited and I do most of what I need with other container tech.
 
Hey,
I know this isn't native to Proxmox
and I haven't tried it myself yet
but...I thought it MAY be of interest

https://forum.proxmox.com/threads/p...y-lxc-and-qemu-guests-with-cloud-init.152183/

I'm not at all opposed to leveraging some additional ecosystem tooling to close the gap. In this specific case I would just pre-bake the tooling into my base image. Thanks for the pointer!

Very timely as the chaos around the TrueNAS app hosting strategy has me pivoting back to Proxmox as the primary provisioning API.
 
Has there been any update on this? I'd like to implement cloud-init's for containers, and I see that the bugzilla shows that a patch is avaialble. Has this patch been released has anyone implemented cloud-init with LXC?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!