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

KarlB

Renowned Member
Sep 28, 2016
8
0
66
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.