I'm trying to figure out a way that a container or pod can know some specific information about the node that it's being scheduled to. For example, my container might have to know if a GPU is present or not on that node in order to decide whether or not to enable GPU acceleration. Another example would be knowing the $DISPLAY variable of the node to know what X server to output graphics to.
What's the best approach to this?
Thanks
Update: If I could get the node-name from within the container, I could do a lookup against an external service to get the information I need. Is there a way to do this?
OP Here. I've found a somewhat decent way of accomplishing this.
On setting the node up with my cluster i can install a script to source environment variables to a file then volume-mount that file into the container.
Alterntively I could also store config for each ndoe in a separate service and inject the nodeName to lookup properties of a specific node as follows:
Then based on the name, my container can look-up via service or config map a mapping of nodeName to whatever information I need form the node. All I have to do is keep this service/config map up-to-date with the node's information.