[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-01。"],[],[],null,["# Update node labels and taints for existing node pools\n\n[Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page provides instructions on how to dynamically update the\nnode labels and node taints of an existing node pool in a\nGoogle Kubernetes Engine (GKE) Standard cluster.\n\nYou can also dynamically apply and update [network tags](/vpc/docs/add-remove-network-tags)\nin GKE Autopilot or Standard clusters. For\ninstructions, refer to [Use network tags to apply firewall rules to nodes](/kubernetes-engine/docs/how-to/autopilot-network-tags).\n\nOverview\n--------\n\nNode [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)\nand [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)\nare in the object metadata of Kubernetes nodes. Labels are used to schedule Pods\non particular nodes, where taints can be used to steer Pods away from them.\n\nUsing the GKE API, you can apply updates on the node\nlabels, and node taints of an existing GKE node pool without\nneeding to recreate the node pool or disrupt running workloads. The updated node\npool configuration is preserved in GKE, so that future node pool\nupgrades and new node provisions in the node pool will use the new configuration.\n| **Warning:** Dynamic configuration changes are limited to these fields: resource manager tags, network tags, node labels and node taints. Any other field changes in the [UpdateNodePool\n| API](/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools/update) will not occur dynamically, and will result in node recreation.\n\nLimitations\n-----------\n\nThere are some limitations for using the GKE API to dynamically\nupdate node pool configurations:\n\n- The version for the node pool must be 1.19.7-gke.1500 or later.\n- The version for the cluster's control plane must be 1.23.4-gke.300 or later to apply updates to node labels or node taints for existing node pools with [cluster autoscaler enabled](/kubernetes-engine/docs/how-to/cluster-autoscaler). For clusters on earlier versions, you can use the following workaround: [Disable autoscaling](/kubernetes-engine/docs/how-to/cluster-autoscaler#disable_autoscaling) on the node pool, and then update the node labels and/or taints. After the updates have been applied, [re-enable autoscaling](/kubernetes-engine/docs/how-to/cluster-autoscaler#enabling_autoscaling_for_an_existing_node_pool).\n\nUpdating node labels\n--------------------\n\nTo update node labels for a node pool, use the following command: \n\n gcloud container node-pools update \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e \\\n --node-labels=\u003cvar translate=\"no\"\u003e[\u003c/var\u003eNODE_LABEL,...] \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n --location=\u003cvar translate=\"no\"\u003eCONTROL_PLANE_LOCATION\u003c/var\u003e\n [GCLOUD_WIDE_FLAG ...]\n\n| **Warning:** This update overwrites any previous user-specified values.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e: the name of the node pool to update.\n- \u003cvar translate=\"no\"\u003e[NODE_LABEL,...]\u003c/var\u003e: the desired new node labels (for example, `label1=value1,label2=value2`).\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster.\n- \u003cvar translate=\"no\"\u003eCONTROL_PLANE_LOCATION\u003c/var\u003e: the Compute Engine [location](/compute/docs/regions-zones#available) of the control plane of your cluster. Provide a region for regional clusters, or a zone for zonal clusters.\n\nUpdating node taints\n--------------------\n\nTo update node taints for a node pool, use the following command: \n\n gcloud container node-pools update \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e \\\n --node-taints=\u003cvar translate=\"no\"\u003e[\u003c/var\u003eNODE_TAINT,...] \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n --location=\u003cvar translate=\"no\"\u003eCONTROL_PLANE_LOCATION\u003c/var\u003e\n [GCLOUD_WIDE_FLAG ...]\n\n| **Warning:** This update overwrites any previous user-specified values.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e: the name of the node pool to update.\n- \u003cvar translate=\"no\"\u003e[NODE_TAINT,...]\u003c/var\u003e: the desired new node taints (for example, `key1=val1:NoSchedule,key2=val2:PreferNoSchedule`).\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster.\n- \u003cvar translate=\"no\"\u003eCONTROL_PLANE_LOCATION\u003c/var\u003e: the Compute Engine [location](/compute/docs/regions-zones#available) of the control plane of your cluster. Provide a region for regional clusters, or a zone for zonal clusters.\n\nWhat's next\n-----------\n\n- Learn about [node taints to control scheduling.](/kubernetes-engine/docs/how-to/node-taints)\n- [Learn about Network tags](/vpc/docs/add-remove-network-tags).\n- [Learn about labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)"]]