Questa pagina mostra come specificare un'immagine del nodo per i nodi nei cluster in modalità Standard di Google Kubernetes Engine (GKE). Per scoprire di più su come funzionano le immagini dei nodi e sui tipi di immagini dei nodi disponibili, consulta Immagini dei nodi.
I nodi nei cluster GKE Autopilot utilizzano sempre l'immagine del nodo
Container-Optimized OS con containerd
(cos_containerd). Non puoi specificare un'immagine del nodo diversa in
modalità Autopilot.
Prima di iniziare
Prima di iniziare, assicurati di aver eseguito le seguenti operazioni:
Se vuoi utilizzare Google Cloud CLI per questa attività,
installala e poi
inizializza
gcloud CLI. Se hai già installato gcloud CLI, scarica l'ultima
versione eseguendo gcloud components update.
Specifica di un'immagine del nodo
Puoi selezionare l'immagine del nodo che vuoi utilizzare quando crei un nuovo cluster oppure puoi modificare l'immagine del nodo per un cluster esistente.
Creazione di un nuovo cluster
gcloud
Per creare un nuovo cluster con un'immagine nodo specifica, esegui questo comando:
Puoi eseguire l'upgrade di un cluster esistente per utilizzare un'immagine del nodo specifica utilizzando
il comando gcloud container clusters upgrade. Puoi eseguire l'upgrade di tutti i pool di nodi nel cluster oppure puoi specificare un pool di nodi specifico utilizzando --node-pool.
Per eseguire l'upgrade di un cluster esistente in modo che utilizzi un'immagine del nodo specifica, esegui il
seguente comando:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-01 UTC."],[],[],null,["# Specify a node image\n\n[Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page shows you how to specify a node image for nodes in\nGoogle Kubernetes Engine (GKE) Standard mode clusters. To learn about how node images work, and the types of node images that are\navailable, see [Node images](/kubernetes-engine/docs/concepts/node-images).\n\nNodes in GKE Autopilot clusters always use the\n[Container-Optimized OS with containerd](/kubernetes-engine/docs/concepts/using-containerd#about_containerd)\n(`cos_containerd`) node image. You can't specify a different node image in\nAutopilot mode.\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\nSpecifying a node image\n-----------------------\n\nYou can select the node image you want to use when you create a new cluster, or\nyou can change the node image for an existing cluster.\n| **Note:** Starting with GKE node version 1.19, the default node image for Linux nodes is the Container-Optimized OS with Containerd (`cos_containerd`) variant instead of the Container-Optimized OS with Docker (`cos`) variant.\n| **Warning:** In GKE version 1.24 and later, Docker-based node image types are not supported. In GKE version 1.23, you also cannot create new node pools with Docker node image types. You must migrate to a containerd node image type. To learn more about this change, see [About the Docker node image deprecation](/kubernetes-engine/docs/deprecations/docker-containerd).\n\n### Creating a new cluster\n\n### gcloud\n\nTo create a new cluster with a specific node image, run the following command: \n\n gcloud container clusters create \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e --image-type \u003cvar translate=\"no\"\u003eIMAGE_TYPE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name you choose for the cluster.\n- \u003cvar translate=\"no\"\u003eIMAGE_TYPE\u003c/var\u003e: the name of your [node image type](/kubernetes-engine/docs/concepts/node-images#available_node_images).\n\n### Console\n\n1.\n\n\n In the Google Cloud console, go to the **Create a Kubernetes cluster** page.\n\n [Go to Create a Kubernetes cluster](https://console.cloud.google.com/kubernetes/add)\n\n \u003cbr /\u003e\n\n2. Configure your cluster as desired.\n\n3. From the navigation pane, under **Node Pools** , click **Nodes**.\n\n4. In the **Image type** drop-down list, select the desired [node image](/kubernetes-engine/docs/concepts/node-images).\n\n5. Click **Create**.\n\n### Terraform\n\nTo create a new cluster with a specific node image using Terraform, refer\nto the following example: \n\n resource \"google_container_cluster\" \"default\" {\n name = \"gke-standard-zonal-node-image\"\n initial_node_count = 2\n\n node_config {\n image_type = \"cos_containerd\"\n }\n }\n\nTo learn more about using Terraform, see\n[Terraform support for GKE](/kubernetes-engine/docs/resources/use-terraform-gke).\n\n### Upgrading an existing cluster\n\n| **Warning:** In GKE version 1.24 and later, Docker-based node image types are not supported. In GKE version 1.23, you also cannot create new node pools with Docker node image types. You must migrate to a containerd node image type. To learn more about this change, see [About the Docker node image deprecation](/kubernetes-engine/docs/deprecations/docker-containerd).\n\nThis change requires recreating the nodes, which can cause disruption to your\nrunning workloads. For details about this specific change, find the\ncorresponding row in the [manual changes that recreate the nodes using a node\nupgrade strategy without respecting maintenance\npolicies](/kubernetes-engine/docs/concepts/managing-clusters#manual-changes-strategy-but-no-respect-policies)\ntable. To learn more about node updates, see [Planning for node update\ndisruptions](/kubernetes-engine/docs/concepts/managing-clusters#plan-node-disruption).\n| **Caution:** GKE immediately begins recreating the nodes for this change using the node upgrade strategy, regardless of active maintenance policies. GKE depends on [resource\n| availability](/kubernetes-engine/docs/how-to/node-upgrades-quota) for the change. Disabling node auto-upgrades [doesn't prevent this\nchange](/kubernetes-engine/docs/how-to/node-auto-upgrades#disable-only-versions). Ensure that your workloads running on the nodes are prepared for disruption before you initiate this change. \n\n### gcloud\n\nYou can upgrade an existing cluster to use a specific node image by using\nthe `gcloud container clusters upgrade` command. You can upgrade all node\npools in the cluster, or you can specify specific a node pool using\n`--node-pool`.\n\nTo upgrade an existing cluster to use a specific node image, run the\nfollowing command: \n\n gcloud container clusters upgrade \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e --image-type \u003cvar translate=\"no\"\u003eIMAGE_TYPE\u003c/var\u003e \\\n [--node-pool \u003cvar translate=\"no\"\u003ePOOL_NAME\u003c/var\u003e]\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of your existing cluster.\n- \u003cvar translate=\"no\"\u003ePOOL_NAME\u003c/var\u003e: the name of the node pool you want to update.\n- \u003cvar translate=\"no\"\u003eIMAGE_TYPE\u003c/var\u003e: the name of your [node image type](/kubernetes-engine/docs/concepts/node-images#available_node_images).\n\n### Console\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. In the cluster list, click the name of the cluster you want to modify.\n\n3. Click the **Nodes** tab.\n\n4. Under **Node Pools**, click the name of the node pool you want to upgrade.\n\n5. On the **Node pool details** page, click *edit* **Edit**.\n\n6. Under **Node version** , click **Change**.\n\n7. Select the desired [node version](/kubernetes-engine/versioning#versioning) and click **Change** to start the upgrade.\n\nWhat's next\n-----------\n\n- [Learn more about node images](/kubernetes-engine/docs/concepts/node-images).\n- [Learn more about node pools](/kubernetes-engine/docs/concepts/node-pools)."]]