Auf dieser Seite wird erläutert, wie Sie die Größe von Standardclustern von Google Kubernetes Engine (GKE) manuell anpassen. Durch Ändern der Clustergröße können Sie die Anzahl der darin enthaltenen Knoten erhöhen oder reduzieren. Alternativ können Sie Ihren Cluster automatisch skalieren. In diesem Fall passt GKE die Größe Ihrer Knotenpools automatisch an sich ändernde Bedingungen an, z. B. an Änderungen bei Ihren Arbeitslasten und der Ressourcenauslastung.
Diese Anleitung gilt nicht für Autopilot-Cluster in GKE, die automatisch die Größe basierend auf der Anzahl der Pods im Cluster anpassen.
Wenn Sie Ihrem Cluster Knoten hinzufügen oder daraus entfernen, fügt GKE die zugehörigen VM-Instanzen der zugrunde liegenden Compute Engine-MIGs hinzu oder entfernt sie, die für Ihre Knotenpools bereitgestellt wurden. Verwenden Sie zum Entfernen von Knoten kubectl delete node nicht, da die Compute Engine-VM-Instanz in der zugrunde liegenden verwalteten Instanzgruppe des Knotenpools nicht gelöscht wird. Verwenden Sie Cluster Autoscaler oder verringern Sie die Größe des Clusters manuell.
Hinweise
Führen Sie die folgenden Aufgaben aus, bevor Sie beginnen:
Wenn Sie die Google Cloud CLI für diese Aufgabe verwenden möchten, müssen Sie die gcloud CLI installieren und dann initialisieren. Wenn Sie die gcloud CLI bereits installiert haben, rufen Sie die neueste Version mit gcloud components update ab.
Größe eines Clusters erhöhen
Wenn Sie die Größe eines Clusters erhöhen, treten die folgenden Änderungen auf:
neue Knoteninstanzen mit derselben Konfiguration wie die der vorhandenen Instanzen werden erstellt,
möglicherweise werden neue Pods auf den neuen Instanzen geplant und
vorhandene Pods nicht auf die neuen Instanzen verschoben.
CLUSTER_NAME ist der Name des Clusters, dessen Größe geändert werden soll.
POOL_NAME ist der Name des Knotenpools, dessen Größe geändert werden soll.
NUM_NODES ist die Anzahl der Knoten im Pool in einem zonalen Cluster. Wenn Sie multizonale oder regionale Cluster verwenden, ist NUM_NODES die Anzahl der Knoten jeder Zone, in der sich die Knotenpools befinden.
Wiederholen Sie diesen Befehl für weitere Knotenpools. Wenn Ihr Cluster nur einen einzigen Knotenpool hat, lassen Sie das Flag --node-pool weg.
Console
Zum Vergrößern der Knotenpools eines Clusters führen Sie die folgenden Schritte aus:
Öffnen Sie in der Google Cloud Console die Seite Google Kubernetes Engine.
Klicken Sie neben dem Cluster, den Sie bearbeiten möchten, auf Aktionenmore_vert und dann auf Bearbeiten.
Klicken Sie neben dem Tab Details auf den Tab Knoten.
Klicken Sie im Bereich Knotenpools auf den Namen des Knotenpools, den Sie vergrößern möchten.
Klicken Sie auf Größe ändernedit.
Geben Sie im Feld Anzahl der Knoten den gewünschten Wert für den Knotenpool ein und klicken Sie dann auf Größe ändern.
Wiederholen Sie den Vorgang nach Bedarf für weitere Knotenpools.
Größe eines Clusters verringern
Wenn Sie die Größe eines Clusters verringern, werden die folgenden Änderungen vorgenommen:
GKE beendet Knoten, die gelöscht werden, ordnungsgemäß mithilfe des Drain-Prozesses, um die Pods aus der Instanz zu entfernen. PodDisruptionBudget und terminationGracePeriodSeconds werden jeweils bis zu einer Stunde lang berücksichtigt.
Die von einem Replikations-Controller verwalteten Pods werden vom Controller neu geplant, um sie auf den verbleibenden Instanzen auszuführen.
Nicht von einem Replikations-Controller verwaltete Pods werden nicht neu gestartet.
Die MIG unterscheidet nicht zwischen Instanzen, in denen Pods ausgeführt werden, und Instanzen ohne Pods. Beim Verringern der Größe werden Instanzen nach dem Zufallsprinzip entfernt.
CLUSTER_NAME ist der Name des Clusters, dessen Größe geändert werden soll.
POOL_NAME ist der Name des Knotenpools, dessen Größe geändert werden soll.
NUM_NODES ist die Anzahl der Knoten im Pool in einem zonalen Cluster. Wenn Sie multizonale oder regionale Cluster verwenden, ist NUM_NODES die Anzahl der Knoten jeder Zone, in der sich die Knotenpools befinden.
Wiederholen Sie diesen Befehl für weitere Knotenpools. Wenn Ihr Cluster nur einen einzigen Knotenpool hat, lassen Sie das Flag --node-pool weg.
Console
Zum Verringern der Größe der Knotenpools eines Clusters führen Sie die folgenden Schritte aus:
Öffnen Sie in der Google Cloud Console die Seite Google Kubernetes Engine.
Klicken Sie neben dem Cluster, den Sie bearbeiten möchten, auf Aktionenmore_vert und dann auf Bearbeiten.
Klicken Sie neben dem Tab Details auf den Tab Knoten.
Klicken Sie im Bereich Knotenpools auf den Namen des Knotenpools, den Sie verkleinern möchten.
Klicken Sie auf Größe ändernedit.
Geben Sie im Feld Anzahl der Knoten den gewünschten Wert für den Knotenpool ein und klicken Sie dann auf Größe ändern.
Wiederholen Sie den Vorgang nach Bedarf für weitere Knotenpools.
Cluster automatisch skalieren
Mit der GKE-Funktion Cluster Autoscaler können Sie die Größe der Knotenpools anpassen, wenn sich beispielsweise die Arbeitslasten oder die Ressourcenauslastung ändern.
Weitere Informationen zur Funktionsweise der automatischen Skalierung erhalten Sie in der Dokumentation zu Cluster Autoscaler. Informationen zum Einrichten von Autoscaling für Cluster finden Sie unter Autoscaling von Clustern.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Resize a Standard cluster by adding or removing nodes\n\n[Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page explains how to manually resize Google Kubernetes Engine (GKE)\nStandard clusters. You can resize a cluster to increase or decrease the\nnumber of nodes in that cluster. Alternatively, you can [autoscale](#autoscale)\nyour cluster, where GKE automatically resizes your node pools in\nresponse to changing conditions, such as changes in your workloads and resource\nusage.\n\nThese instructions don't apply to GKE\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview)\nclusters, which automatically resize based on the number of Pods in the cluster.\n\nWhen you add or remove nodes in your cluster, GKE adds or removes\nthe associated virtual machine (VM) instances from the underlying\nCompute Engine [Managed Instance Groups\n(MIGs)](/compute/docs/instance-groups#managed_instance_groups) provisioned for\nyour node pools. For removing nodes, do not use `kubectl delete node` as this\ndoes not delete the Compute Engine VM instance in the node pool's underlying\nMIG. Use [cluster autoscaler](#autoscale) or manually [decrease the size of your\ncluster](#decrease).\n| **Note:** When you increase or decrease the size of a node pool that spans multiple zones, the new size represents the number of nodes in the node pool per zone. For example, if you have a node pool size of two that spans two zones, the total node count is four. If you resize the node pool to a size of four nodes, the total node count becomes eight.\n\nBefore you begin\n----------------\n\nBefore you start, make sure that you have performed the following tasks:\n\n- Enable the Google Kubernetes Engine API.\n[Enable Google Kubernetes Engine API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n- If you want to use the Google Cloud CLI for this task, [install](/sdk/docs/install) and then [initialize](/sdk/docs/initializing) the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running `gcloud components update`. **Note:** For existing gcloud CLI installations, make sure to set the `compute/region` [property](/sdk/docs/properties#setting_properties). If you use primarily zonal clusters, set the `compute/zone` instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: `One of [--zone, --region] must be supplied: Please specify location`. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.\n\nIncrease the size of your cluster\n---------------------------------\n\nWhen you increase the size of a cluster, the following changes occur:\n\n- New node instances are created using the same configuration as the existing instances.\n- New Pods may be scheduled on the new instances.\n- Existing Pods are **not** moved to the new instances.\n\n### gcloud\n\nTo increase the size of a cluster's node pools, run the [`gcloud container clusters resize`](/sdk/gcloud/reference/container/clusters/resize) command: \n\n```\ngcloud container clusters resize CLUSTER_NAME --node-pool POOL_NAME \\\n --num-nodes NUM_NODES\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster to resize.\n- \u003cvar translate=\"no\"\u003ePOOL_NAME\u003c/var\u003e: the name of the node pool to resize.\n- \u003cvar translate=\"no\"\u003eNUM_NODES\u003c/var\u003e: the number of nodes in the pool in a zonal cluster. If you use multi-zonal or regional clusters, \u003cvar translate=\"no\"\u003eNUM_NODES\u003c/var\u003e is the number of nodes for each zone the node pools is in.\n\nRepeat this command for each node pool. If your cluster has only one node\npool, omit the `--node-pool` flag.\n\n### Console\n\nTo increase the size of a cluster's node pools, perform the following steps:\n\n1. Go to the **Google Kubernetes Engine** page in the Google Cloud console.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. Beside the cluster you want to edit, click *more_vert*\n **Actions** , then click **Edit**.\n\n3. Click the **Nodes** tab next to the **Details** tab.\n\n4. In the **Node Pools** section, click the name of the node pool that you\n want to increase in size.\n\n5. Click *edit* **Resize**.\n\n6. In the **Number of nodes** field, enter how many nodes that you want in\n the node pool, and then click **Resize**.\n\n7. Repeat for each node pool as needed.\n\nDecrease the size of your cluster\n---------------------------------\n\n| **Warning:** Do not use both cluster autoscaler and manual resize commands simultaneously on a node pool, as this can cause interactions that result in unstable or incorrect node pool size.\n\nWhen you decrease the size of a cluster, the following changes occur:\n\n- GKE gracefully terminates nodes that are being deleted, using the [drain](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/) process to remove the Pods from the instance. [`PodDisruptionBudget`](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) and [`terminationGracePeriodSeconds`](https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods) are both respected for up to one hour.\n- Pods managed by a replication controller are rescheduled by the controller to run on the remaining instances.\n- Pods not managed by a replication controller are not restarted.\n\nThe MIG does not differentiate between instances running\nPods and instances without Pods. Resizing down removes instances at random.\n\nTo learn how to add node pools and to manage existing ones, refer to\n[Adding and managing node pools](/kubernetes-engine/docs/how-to/node-pools). \n\n### gcloud\n\nTo decrease the size of a cluster's node pools, run the [`gcloud container clusters resize`](/sdk/gcloud/reference/container/clusters/resize) command: \n\n```\ngcloud container clusters resize CLUSTER_NAME --node-pool POOL_NAME \\\n --num-nodes NUM_NODES\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster to resize.\n- \u003cvar translate=\"no\"\u003ePOOL_NAME\u003c/var\u003e: the name of the node pool to resize.\n- \u003cvar translate=\"no\"\u003eNUM_NODES\u003c/var\u003e: the number of nodes in the pool in a zonal cluster. If you use multi-zonal or regional clusters, \u003cvar translate=\"no\"\u003eNUM_NODES\u003c/var\u003e is the number of nodes for each zone the node pools is in.\n\nRepeat this command for each node pool. If your cluster has only one node\npool, omit the `--node-pool` flag.\n\n### Console\n\nTo decrease the size of a cluster's node pools, perform the following steps:\n\n1. Go to the **Google Kubernetes Engine** page in the Google Cloud console.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. Beside the cluster you want to edit, click *more_vert*\n **Actions** , then click **Edit**.\n\n3. Click the **Nodes** tab next to the **Details** tab.\n\n4. In the **Node Pools** section, click the name of the node pool that you\n want to decrease in size.\n\n5. Click *edit* **Resize**.\n\n6. In the **Number of nodes** field, enter how many nodes that you want in\n the node pool, and then click **Resize**.\n\n7. Repeat for each node pool as needed.\n\nAutoscaling a cluster\n---------------------\n\nGKE's [cluster autoscaler](/kubernetes-engine/docs/concepts/cluster-autoscaler) feature automatically resizes\nyour node pools in response to changing conditions, such as changes in your\nworkloads and resource usage.\n\nTo learn more about how autoscaling works, refer to the [cluster autoscaler](/kubernetes-engine/docs/concepts/cluster-autoscaler)\ndocumentation. To set up autoscaling for your cluster, see\n[Autoscaling a cluster](/kubernetes-engine/docs/how-to/cluster-autoscaler).\n\nWhat's next\n-----------\n\n- [Learn more about clusters](/kubernetes-engine/docs/concepts/cluster-architecture)."]]