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:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Creating a GKE cluster with a tainted default node pool
- Adding an untainted node pool
- Updating node pool taints post‐creation
- Provisioning a dedicated node pool with a unique taint
- Deploying pods with and without tolerations to observe scheduling behavior
- 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).
Node Pools & Taints Overview
| Node Pool | Taint | Purpose |
|---|---|---|
| default | function=research:PreferNoSchedule | Research workloads |
| gke-deep-dive-pool | none | Shared/utility services |
| gke-deep-dive-pool (updated) | function=shared:NoSchedule | Shared services |
| gke-deep-dive-pool-dedicated | dedicated=dev:NoExecute | Development workloads |
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
2. Add an Untainted Node Pool
New node pools inherit no taints by default. Create one:3. Update a Node Pool’s Taint
Apply a new taint to the existing pool: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 asshared-pod.yaml:
function=shared:NoSchedule.
6. Remove the Taint from the Default Node Pool
First, identify the default node:Removing taints allows all untolerated pods to schedule on this node pool. Plan accordingly.
7. Deploy a Pod Without Any Toleration
Save asdedicated-pod.yaml:
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.