如何以编程方式获取GKE支持的Kubernetes版本列表? [英] How to programmatically get list of supported Kubernetes versions for GKE?
问题描述
此处列出了受支持的版本:
The supported versions are listed here:
https://cloud.google.com/container-engine/supported-versions
但是我想知道是否有一种方法可以通过gcloud
或其他类似工具以编程方式获取此列表(我想除了抓取该页面以外)?
but I'm wondering if there is a way to programatically get this list (besides scraping that page, I guess) via gcloud
or some similar tool?
我发现硬编码单个版本经常会失败,因为Google一直在更新受支持的版本.同时,我希望至少指定较大的版本(例如1.7.x),因为1.8.x似乎带来了一些重大更改.
I find that hard-coding a single version breaks often because Google keeps updating the supported versions. At the same time, I /would/ like to specify at least the large version (e.g., 1.7.x) because it appears that 1.8.x introduces some breaking changes, for example.
推荐答案
gcloud"get-server-config"将为您获取所需的数据.指定"--format"选项还可以通过一种易于解析的方式将其返回:
The gcloud "get-server-config" will get you the data you want. Specifying the "--format" option can also return it in a way that's easy to parse:
gcloud container get-server-config --zone=us-central1-f --format=json
如果您希望控制何时进行更新,则维护窗口选项也可以帮助您控制何时进行更新. https://cloud.google.com/container-engine/docs/maintenance-window
If you wish to control when updates happen, the maintenance window option may also help you control when you want them to occur. https://cloud.google.com/container-engine/docs/maintenance-window
这篇关于如何以编程方式获取GKE支持的Kubernetes版本列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!