I have a use case with elastic search for rack awareness, which requires me to identify the zone that a pod has been scheduled in.
I've seen many requests for this outside of SO, such as:
https://github.com/kubernetes/kubernetes/issues/40610
The zone is not exposed in the downward API due to it being a node label, not a pod label.
The two "answers" I have come up with are:
a) Curl request to the google metadata endpoint to retrieve the node from the compute engine metadata
b) Identify the node name via the downward API, and make a call to the Kube API with the node name to retrieve the node object, and use a tool such as JQ to filter the JSON response to get the zone.
I don't like option B due to it being more or less hardcoded against the API call, and I would need to provision a custom docker image with JQ and curl included. Option A feels a bit 'hacky' given it's not Kube native.
Are there any better solutions that I've missed?
Thanks in advance,