Update Kubernetes node labels and taints for node pools


This page provides instructions on how to update the Kubernetes node labels and node taints of an existing node pool in a Google Kubernetes Engine (GKE) Standard cluster by using the GKE API. Kubernetes node labels are distinct from GKE cluster and node labels .

Node taints and labels are in the object metadata of Kubernetes nodes. Kubernetes labels are used to schedule Pods on particular nodes. In contrast, taints can be used to steer Pods away from particular nodes. For more information, see Configure workload separation in GKE .

Using the GKE API, you can apply updates to the Kubernetes node labels and node taints of an existing GKE node pool without re-creating the node pool and disrupting running workloads. The updated node pool configuration is preserved in GKE, so that future node pool upgrades and new nodes provisioned in the node pool will use the new configuration.

For more information about how changes affect the operation of a GKE cluster, see Manage cluster lifecycle changes to minimize disruption . For details about specific changes, see the Types of changes to a GKE clustersection.

Updating node labels

To update node labels for a node pool, use the following command:

 gcloud  
container  
node-pools  
update  
 NODEPOOL_NAME 
  
 \ 
  
--node-labels = [ 
 
NODE_LABEL,... ] 
  
 \ 
  
--cluster = 
 CLUSTER_NAME 
  
--location = 
 CONTROL_PLANE_LOCATION 
  
 [ 
GCLOUD_WIDE_FLAG  
 ] 
 

Replace the following:

  • NODEPOOL_NAME : the name of the node pool to update.
  • [NODE_LABEL,...] : the desired new node labels (for example, label1=value1,label2=value2 ).
  • CLUSTER_NAME : the name of the cluster.
  • CONTROL_PLANE_LOCATION : the Compute Engine location of the control plane of your cluster. Provide a region for regional clusters, or a zone for zonal clusters.

Updating node taints

To update node taints for a node pool, use the following command:

 gcloud  
container  
node-pools  
update  
 NODEPOOL_NAME 
  
 \ 
  
--node-taints = [ 
 
NODE_TAINT,... ] 
  
 \ 
  
--cluster = 
 CLUSTER_NAME 
  
--location = 
 CONTROL_PLANE_LOCATION 
  
 [ 
GCLOUD_WIDE_FLAG  
 ] 
 

Replace the following:

  • NODEPOOL_NAME : the name of the node pool to update.
  • [NODE_TAINT,...] : the desired new node taints (for example, key1=val1:NoSchedule,key2=val2:PreferNoSchedule ).
  • CLUSTER_NAME : the name of the cluster.
  • CONTROL_PLANE_LOCATION : the Compute Engine location of the control plane of your cluster. Provide a region for regional clusters, or a zone for zonal clusters.
Create a Mobile Website
View Site in Mobile | Classic
Share by: