Halaman ini berisi petunjuk cara mengupdate label node
dan taint node dari node pool yang ada di
cluster Google Kubernetes Engine (GKE) Standard secara dinamis.
Taint dan label node berada di metadata objek node Kubernetes. Label digunakan untuk menjadwalkan Pod
pada node tertentu, tempat taint dapat digunakan untuk menjauhkan Pod dari node tersebut.
Dengan GKE API, Anda dapat menerapkan update pada label node, dan taint node dari node pool GKE yang ada tanpa
perlu membuat ulang node pool atau menghentikan workload yang sedang berjalan. Konfigurasi node pool
yang baru akan dipertahankan di GKE, sehingga upgrade node pool di masa mendatang
dan penyediaan node baru dalam node pool akan menggunakan konfigurasi baru tersebut.
Batasan
Ada beberapa batasan saat menggunakan GKE API untuk memperbarui
konfigurasi node pool secara dinamis:
Versi node pool harus 1.19.7-gke.1500 atau yang lebih baru.
Versi bidang kontrol cluster harus 1.23.4-gke.300 atau yang lebih baru agar dapat
menerapkan update pada label node atau taint node untuk node pool yang ada dengan
autoscaler cluster aktif.
Untuk cluster pada versi sebelumnya, Anda dapat menggunakan solusi berikut:
Nonaktifkan penskalaan otomatis
pada node pool, lalu update label dan/atau taint node. Setelah
update diterapkan, aktifkan kembali penskalaan otomatis.
Mengupdate label node
Untuk mengupdate label node pada node pool, gunakan perintah berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-01 UTC."],[],[],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/)"]]