This page shows you how to specify a node image for nodes in Google Kubernetes Engine (GKE) Standard mode clusters. To learn about how node images work, and the types of node images that are available, see Node images.
Nodes in GKE Autopilot clusters always use the
Container-Optimized OS with containerd
(cos_containerd
) node image.
Before you begin
Before you start, make sure you have performed the following tasks:
- Enable the Google Kubernetes Engine API. Enable Google Kubernetes Engine API
- If you want to use the Google Cloud CLI for this task,
install and then
initialize the
gcloud CLI. If you previously installed the gcloud CLI, get the latest
version by running
gcloud components update
.
Specifying a node image
You can select the node image you want to use when you create a new cluster, or you can change the node image for an existing cluster.
Creating a new cluster
gcloud
To create a new cluster with a specific node image, run the following command:
gcloud container clusters create CLUSTER_NAME --image-type IMAGE_TYPE
Replace the following:
CLUSTER_NAME
: the name you choose for the cluster.IMAGE_TYPE
: the name of your node image type.
Console
Go to the Google Kubernetes Engine page in the Google Cloud console.
Click add_box Create.
Configure your cluster as desired.
From the navigation pane, under Node Pools, click Nodes.
In the Image type drop-down list, select the desired node image.
Click Create.
Terraform
To create a new cluster with a specific node image using Terraform, refer to the following example:
To learn more about using Terraform, see Terraform support for GKE.
Upgrading an existing cluster
This change requires recreating the nodes, which can cause disruption to your running workloads. For details about this specific change, find the corresponding row in the manual changes that recreate the nodes using a node upgrade strategy without respecting maintenance policies table. To learn more about node updates, see Planning for node update disruptions.
gcloud
You can upgrade an existing cluster to use a specific node image by using
the gcloud container clusters upgrade
command. You can upgrade all node
pools in the cluster, or you can specify specific a node pool using
--node-pool
.
To upgrade an existing cluster to use a specific node image, run the following command:
gcloud container clusters upgrade CLUSTER_NAME --image-type IMAGE_TYPE \
[--node-pool POOL_NAME]
Replace the following:
CLUSTER_NAME
: the name of your existing cluster.POOL_NAME
: the name of the node pool you want to update.IMAGE_TYPE
: the name of your node image type.
Console
Go to the Google Kubernetes Engine page in the Google Cloud console.
In the cluster list, click the name of the cluster you want to modify.
Click the Nodes tab.
Under Node Pools, click the name of the node pool you want to upgrade.
On the Node pool details page, click edit Edit.
Under Node version, click Change.
Select the desired node version and click Change to start the upgrade.