Specifying a node image


This page shows you how to specify a node image for your nodes in Google Kubernetes Engine (GKE).

To learn about how node images work, and the types of node images that are available, see Node images.

Before you begin

Before you start, make sure you have performed the following tasks:

Set up default gcloud settings using one of the following methods:

  • Using gcloud init, if you want to be walked through setting defaults.
  • Using gcloud config, to individually set your project ID, zone, and region.

Using gcloud init

If you receive the error One of [--zone, --region] must be supplied: Please specify location, complete this section.

  1. Run gcloud init and follow the directions:

    gcloud init

    If you are using SSH on a remote server, use the --console-only flag to prevent the command from launching a browser:

    gcloud init --console-only
  2. Follow the instructions to authorize gcloud to use your Google Cloud account.
  3. Create a new configuration or select an existing one.
  4. Choose a Google Cloud project.
  5. Choose a default Compute Engine zone for zonal clusters or a region for regional or Autopilot clusters.

Using gcloud config

  • Set your default project ID:
    gcloud config set project PROJECT_ID
  • If you are working with zonal clusters, set your default compute zone:
    gcloud config set compute/zone COMPUTE_ZONE
  • If you are working with Autopilot or regional clusters, set your default compute region:
    gcloud config set compute/region COMPUTE_REGION
  • Update gcloud to the latest version:
    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_NAME

Replace the following:

  • CLUSTER_NAME: the name you choose for the cluster.
  • IMAGE_NAME: the name of your node image type, which can be one of the following values:
    • cos_containerd: Container-Optimized OS with Containerd
    • cos: Container-Optimized OS with Docker
    • ubuntu_containerd: Ubuntu with Containerd
    • ubuntu: Ubuntu with Docker
    • windows_ltsc_containerd: Windows Server SAC with Containerd
    • windows_sac_containerd: Windows Server LTSC with Containerd
    • windows_ltsc: Windows Server LTSC with Docker
    • windows_sac: Windows Server SAC with Docker

Console

  1. Go to the Google Kubernetes Engine page in the Cloud Console.

    Go to Google Kubernetes Engine

  2. Click Create.

  3. Configure your cluster as desired.

  4. From the navigation pane, under Node Pools, click Nodes.

  5. In the Image type drop-down list, select the desired node image.

  6. Click Create.

Upgrading an existing cluster

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_NAME \
    [--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_NAME: the name of your node image type, which can be one of the following values:
    • cos_containerd: Container-Optimized OS with Containerd
    • cos: Container-Optimized OS with Docker
    • ubuntu_containerd: Ubuntu with Containerd
    • ubuntu: Ubuntu with Docker
    • windows_ltsc_containerd: Windows Server SAC with Containerd
    • windows_sac_containerd: Windows Server LTSC with Containerd
    • windows_ltsc: Windows Server LTSC with Docker
    • windows_sac: Windows Server SAC with Docker

Console

  1. Go to the Google Kubernetes Engine page in Cloud Console.

    Go to Google Kubernetes Engine

  2. In the cluster list, click the name of the cluster you want to modify.

  3. Click the Nodes tab.

  4. Under Node Pools, click the name of the node pool you want to upgrade.

  5. On the Node pool details page, click Edit.

  6. Under Node version, click Change.

  7. Select the desired node version and click Change to start the upgrade.

What's next