1

For a multi zoned, multi cluster setup. Is it possible to dynamically expose or retrieve the zone in which the master node is running, from a pod? Since this is needed to correctly push our metrics to stackdriver, in order to run a horizontal pod autoscaler based on them.

I can hardcode it in the individual deployments but I would like to avoid that.

I've tried looking in the compute internal metadata endpoint, and in the reference variables kubernetes has, but none seem to expose the zone of the master.

4

1 回答 1

2

有一种非官方的方法可以通过解析kube-env节点上的元数据条目来确定主节点正在运行的区域(或区域)。kube-env是一个键值存储,其中键都是大写的,后跟冒号,然后是值。如果您查找键ZONE,则值将是集群位置(例如,具有单个区域主节点的多区域集群的主区域或区域集群的主区域)。

请注意,这不是受支持的 API,因此它可能会在 GKE 的未来版本中消失,但目前它是一种从任何节点获取集群位置的简单方法。

于 2017-12-21T05:03:18.730 回答