<p>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.</p>

<p>What's the best approach to this? </p>

<p>Thanks</p>

<p>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?</p>

<p>OP Here. I've found a somewhat decent way of accomplishing this.</p>

<p>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.</p>

<p>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:</p>

<p><a href="https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables</a></p>

<p>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.</p>
