Skip to main content
In this tutorial, you’ll learn how to control pod placement in Google Kubernetes Engine (GKE) by applying node taints and tolerations. We’ll cover:
  1. Creating a GKE cluster with a tainted default node pool
  2. Adding an untainted node pool
  3. Updating node pool taints post‐creation
  4. Provisioning a dedicated node pool with a unique taint
  5. Deploying pods with and without tolerations to observe scheduling behavior
  6. Removing a taint and watching pods land on the default pool

Prerequisites

  • Google Cloud SDK installed or access to Cloud Shell.
  • Authentication configured (gcloud auth login).
Set your project and compute zone:

Node Pools & Taints Overview


1. Create a Cluster with a Tainted Default Node Pool

Cluster provisioning can take 10–15 minutes. Use gcloud container operations list to track progress.

Verify the Taint

Expected output:

2. Add an Untainted Node Pool

New node pools inherit no taints by default. Create one:
Verify:
Expected:

3. Update a Node Pool’s Taint

Apply a new taint to the existing pool:
Verify:
Expected:

4. Create a Dedicated Node Pool with a Different Taint

Provision a third pool for development workloads:

5. Deploy a Pod That Tolerates the Shared Taint

Save as shared-pod.yaml:
Apply and inspect scheduling:
The pod should land on the node with function=shared:NoSchedule.

6. Remove the Taint from the Default Node Pool

First, identify the default node:
Then remove its taint:
Verify:
Expected:
Removing taints allows all untolerated pods to schedule on this node pool. Plan accordingly.

7. Deploy a Pod Without Any Toleration

Save as dedicated-pod.yaml:
Apply and observe:
Since the default pool is now untainted, dedicated-pod transitions from Pending to Running on the default node.
Congratulations! You’ve successfully used node taints and tolerations to control pod placement in a GKE cluster.

Watch Video