[SOLVED] How to get the node info or inject data into a container?

KarlB

Active Member
Sep 28, 2016
8
0
41
40
I have containers in a cluster with multiple nodes. I want my containers to know which node they are running on, as my nodes are geographically separated and there are resources in the same data centre (services, database instances, etc) that they should use instead of using a remote resource in order to reduce latency.

Ideally, the container would have some way of knowing which node it is running on. But I can't see a way to expose that information easily? A mount point that doesn't replicate prevents migration - so that isn't an option.

Am I going about this the wrong way, or is there an easy way to achieve what I'm trying to do?
 
If you have access to /proc/cmdline from your container, an easy implementatin would be a host-unique string in your kernel command line.
Good idea! That gives me access to the root partition UUID, which is unique per node, so that might do as-is.
 

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!