问题描述
我使用以下CLI命令创建了一个Kubernetes集群:gcloud container clusters create some-cluster --tags=some-tag --network=some-network
I created a Kubernetes cluster with the following CLI command:gcloud container clusters create some-cluster --tags=some-tag --network=some-network
我现在要:
- 禁用
--tags
选项,以便在没有标签some-tag
的情况下创建新节点/VM. (可选:通过gcloud compute instances remove-tags
可以从现有计算机上删除标签.) - 禁用
--network
标志,将群集返回到默认的GCP网络.
- Disable the
--tags
option, so that new nodes/VMs are created without the tagsome-tag
. (Optional: Remove the tag from existing machines, which should be possible throughgcloud compute instances remove-tags
.) - Disable the
--network
flag, returning the cluster to the default GCP network.
这些操作是否可行,还是我必须重新创建集群?
Are either of these operations possible, or will I have to re-create the cluster?
对于上下文,我使用节点标记和网络规则通过作为NAT网关的单个GCE实例路由传出网络流量.我现在想关闭此路由.
For context, I was using the node tags and networking rules to route outgoing network traffic through a single GCE instance serving as a NAT gateway. I now want to turn this routing off.
推荐答案
当前,无法使用gcloud命令更新集群网络并删除现有集群的标签.我已经使用gcloud容器集群更新命令文档.此外, alpha 和 beta 命令尚未提供此功能. API文档还提供与可以更改的不同配置有关的信息.
Currently, its not possible to update cluster network and remove tags for existing cluster using the gcloud command. I have verified this information using the gcloud container clusters update command documentation. Additionally, alpha and beta command don't provide this feature yet. API doc also provides information related to different configuration which can be changed.
作为一种解决方法,我能够使用实例组设置中的滚动更新功能删除其中一个标签:
As a workaround, I was able to remove one of the tags using the rolling update feature within the instance group setting:
- 转到some-cluster的实例模板->选择模板
- 点击(从实例模板顶部复制)->删除标签->创建新模板
- 选择一个集群实例组->单击滚动更新->将实例模板更改为您创建的实例模板->更新
- Go to instance template of some-cluster -> select the template
- Click (copy from the top of instance template)-> Remove the tag -> creates a new template
- Select the some-cluster Instance Group-> click on rolling update -> change the instance template to the one you created -> update
如果您在步骤2中更改了网络,则无法在步骤3中选择具有新网络的实例模板.仅仅更改标签并不能解决您的目的,最好创建一个新集群.
If you change the network in step-2, I was not able to select the instance template with the new network in step-3. Changing the tag alone won’t solve your purpose, it's better to create a new cluster.
如果您有兴趣使用gcloud命令更新标签和网络,建议您在公共问题跟踪器.
If you are interested to update tags and network using the gcloud command, I suggest creating a feature request (FR) in Public Issue tracker.
这篇关于GKE:修改现有集群-删除节点标签并更改网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!