Cette page vous explique comment spécifier une image de nœud pour les nœuds des clusters en mode standard de Google Kubernetes Engine (GKE). Pour en savoir plus sur le fonctionnement des images de nœuds et sur les types d'images de nœuds disponibles, consultez la page Images de nœuds.
Les nœuds des clusters GKE Autopilot utilisent toujours l'image de nœud Container-Optimized OS avec containerd (cos_containerd). Vous ne pouvez pas spécifier une autre image de nœud en mode Autopilot.
Avant de commencer
Avant de commencer, effectuez les tâches suivantes :
Si vous souhaitez utiliser Google Cloud CLI pour cette tâche, installez puis initialisez gcloud CLI. Si vous avez déjà installé gcloud CLI, assurez-vous de disposer de la dernière version en exécutant la commande gcloud components update.
Spécifier une image de nœud
Vous pouvez sélectionner l'image de nœud que vous souhaitez utiliser lorsque vous créez un cluster, ou vous pouvez modifier l'image de nœud d'un cluster existant.
Créer un cluster
gcloud
Pour créer un cluster avec une image de nœud spécifique, exécutez la commande suivante :
Vous pouvez mettre à niveau un cluster existant afin d'utiliser une image de nœud spécifique à l'aide de la commande gcloud container clusters upgrade. Vous pouvez mettre à niveau tous les pools de nœuds du cluster ou indiquer un pool de nœuds spécifique à l'aide de --node-pool.
Pour mettre à niveau un cluster existant de sorte qu'il utilise une image de nœud spécifique, exécutez la commande suivante :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/01 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)."]]