Part-91: ๐Ÿš€ Google Kubernetes Engine (GKE) – Node Pools & Node Selectors

part-91:-google-kubernetes-engine-(gke)-–-node-pools-&-node-selectors

When working with Google Kubernetes Engine (GKE), youโ€™ll come across two powerful concepts:

  • ๐Ÿ‘‰ Node Pools
  • ๐Ÿ‘‰ Node Selectors

These help you control how your workloads run on nodes inside your Kubernetes cluster. Letโ€™s break them down step by step.

๐ŸŸข Node Pools in GKE

A Node Pool is basically a group of nodes in a GKE cluster with the same configuration.

n1

  • When you create a cluster, GKE automatically creates a default node pool.
  • You can add more node pools with different configurations depending on your workload needs.

๐Ÿ”‘ Each node in a pool has a label like this:

cloud.google.com/gke-nodepool: default-pool
cloud.google.com/gke-nodepool: linuxapps-pool

So, GKE automatically labels nodes by their pool name.

โœจ Why Node Pools are Useful?

You can categorize workloads by creating node pools with specific configurations. For example:

  • ๐Ÿ–ด Node pool with local SSDs for high I/O apps
  • โšก Node pool with minimum CPU platform for performance tuning
  • ๐Ÿ’ฐ Node pool with Spot VMs for cost savings
  • ๐Ÿ–ฅ๏ธ Node pool with a specific machine type (e.g., e2-standard-4)
  • ๐Ÿ–ผ๏ธ Node pool with a specific node image (e.g., Container-Optimized OS vs Ubuntu)

๐Ÿ‘‰ You can resize node pools by adding/removing nodes.
๐Ÿ‘‰ You can enable Cluster Autoscaler so node pools automatically scale up/down based on usage.

โš ๏ธ Important: You cannot change a single nodeโ€™s config inside a node pool. Any change applies to the entire pool.

๐ŸŸก Kubernetes Node Selectors

n2

A Node Selector is a simple way to tell Kubernetes where your Pod should run.

Itโ€™s part of the Pod spec and works with key-value labels.

Example: If you want a Pod to run only in the linuxapps-pool node pool ๐Ÿ‘‡

apiVersion: v1
kind: Pod
metadata:
  name: my-linux-app
spec:
  nodeSelector:
    cloud.google.com/gke-nodepool: linuxapps-pool
  containers:
    - name: my-container
      image: nginx

Hereโ€™s what happens:

  • Kubernetes looks at your cluster nodes.
  • It finds nodes with the label cloud.google.com/gke-nodepool=linuxapps-pool.
  • It schedules your Pod there. โœ…

๐Ÿ”‘ Quick Recap

  • Node Pools = groups of nodes with the same configuration.
  • Node Selectors = simple rules to make sure Pods land on the right nodes.

Together, these give you fine-grained control over workload placement in GKE.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
part-87:-kubernetes-deployments-with-imperative-commands-in-gcp-(google-kubernetes-engine)

Part-87: ๐Ÿš€ Kubernetes Deployments with Imperative Commands in GCP (Google Kubernetes Engine)

Next Post
hema-miso:-heterogeneous-memory-architecture-for-llm-inference-with-sw-optimization

HeMA-MISO: Heterogeneous Memory Architecture for LLM Inference with SW Optimization

Related Posts