Skip to main content

Command Palette

Search for a command to run...

πŸš€ A Complete Guide to Google Kubernetes Engine (GKE) with Step-by-Step Execution

Published
β€’4 min read
πŸš€ A Complete Guide to Google Kubernetes Engine (GKE) with Step-by-Step Execution
B

I am Bittu Sharma, a DevOps & AI Engineer with a keen interest in building intelligent, automated systems. My goal is to bridge the gap between software engineering and data science, ensuring scalable deployments and efficient model operations in production.! π—Ÿπ—²π˜'π˜€ π—–π—Όπ—»π—»π—²π—°π˜ I would love the opportunity to connect and contribute. Feel free to DM me on LinkedIn itself or reach out to me at bittush9534@gmail.com. I look forward to connecting and networking with people in this exciting Tech World.

Kubernetes (K8s) has become the de facto standard for container orchestration. While setting up Kubernetes clusters manually can be challenging, cloud providers like Google Cloud Platform (GCP) simplify the process with Google Kubernetes Engine (GKE).

In this blog, we’ll dive into:

  • What GKE is and why it’s used

  • Key features of GKE

  • Step-by-step execution (with commands)

  • Deploying an NGINX application on GKE

  • Real-world use cases


πŸ”Ή What is Google Kubernetes Engine (GKE)?

Google Kubernetes Engine (GKE) is a managed Kubernetes service offered by Google Cloud. It allows developers and DevOps engineers to deploy, manage, and scale containerized applications without worrying about the complexities of managing Kubernetes infrastructure.

πŸ‘‰ Simply put, GKE = Kubernetes + Google Cloud automation + scalability.


πŸ”Ή Why Use GKE?

Some key benefits of GKE:
βœ… Managed Control Plane – Google handles cluster upgrades, patches, and scaling.
βœ… Auto-Scaling – Automatically scales your cluster based on workload.
βœ… Integrated with GCP – Easy integration with IAM, Cloud Monitoring, Logging, and Storage.
βœ… Security – Automatic upgrades, RBAC, private clusters, and workload identity.
βœ… High Availability – Regional clusters ensure workloads are resilient.


πŸ”Ή GKE Cluster Architecture

A GKE cluster consists of:

  1. Control Plane (Master): Managed by Google (API Server, Scheduler, Controller).

  2. Node Pools: Virtual Machines (VMs) in GCP where containers run.

  3. Pods: Smallest deployable unit containing your containers.


πŸ”Ή Prerequisites

Before starting, ensure you have:

  • A Google Cloud Account (Free Tier gives $300 credits).

  • gcloud CLI installed β†’ Install Guide.

  • kubectl CLI installed.


πŸ”Ή Step 1: Authenticate with GCP

First, authenticate your gcloud CLI:

gcloud auth login
gcloud config set project <YOUR_PROJECT_ID>

Check your active project:

gcloud config list project

πŸ”Ή Step 2: Create a GKE Cluster

Let’s create a GKE cluster named my-gke-cluster with 3 nodes.

gcloud container clusters create my-gke-cluster \
  --zone us-central1-a \
  --num-nodes=3

πŸ‘‰ This will provision a Kubernetes cluster with 3 worker nodes in us-central1-a.


πŸ”Ή Step 3: Connect to Your Cluster

Once the cluster is ready, connect using kubectl:

gcloud container clusters get-credentials my-gke-cluster --zone us-central1-a

Now check your cluster nodes:

kubectl get nodes

Expected Output πŸ‘‡

NAME                                  STATUS   ROLES    AGE   VERSION
gke-my-gke-cluster-default-pool-...   Ready    <none>   1m    v1.29.x

πŸ”Ή Step 4: Deploy an Application (NGINX)

Let’s deploy a sample NGINX web application on GKE.

Create a Deployment

kubectl create deployment nginx-deployment --image=nginx

Verify deployment:

kubectl get deployments
kubectl get pods

Expose the Deployment

Expose the deployment using a LoadBalancer service:

kubectl expose deployment nginx-deployment \
  --type=LoadBalancer \
  --port=80 \
  --target-port=80

Check service details:

kubectl get service

Expected Output πŸ‘‡

NAME                TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)        AGE
nginx-deployment    LoadBalancer   10.0.34.250   34.67.xxx.xxx   80:30871/TCP   1m

πŸ‘‰ Copy the EXTERNAL-IP and paste in your browser β€” you should see the default NGINX welcome page πŸŽ‰.


πŸ”Ή Step 5: Scale Your Application

Scaling up your app in GKE is easy:

kubectl scale deployment nginx-deployment --replicas=5

Check pods:

kubectl get pods -o wide

Now you’ll see 5 replicas of NGINX running in your GKE cluster.


πŸ”Ή Step 6: Clean Up Resources

To avoid unnecessary billing, delete your cluster when done:

gcloud container clusters delete my-gke-cluster --zone us-central1-a

πŸ”Ή Real-World Use Cases of GKE

GKE is widely used in production for:

  • Microservices Architecture – Managing multiple containerized services.

  • CI/CD Pipelines – Deploying applications using GitOps or Jenkins.

  • Big Data & AI – Running ML pipelines and data processing workloads.

  • Hybrid Cloud – Using Anthos to extend GKE across on-premises and multi-cloud.


πŸ”Ή Final Thoughts

GKE simplifies Kubernetes by removing the complexity of managing the control plane and providing powerful features like auto-scaling, security, and deep GCP integration.

In this blog, we:
βœ”οΈ Learned what GKE is
βœ”οΈ Set up a GKE cluster
βœ”οΈ Deployed and scaled an application
βœ”οΈ Understood real-world use cases

πŸ‘‰ If you’re a DevOps Engineer, Cloud Engineer, or Developer, mastering GKE will boost your cloud-native journey πŸš€.