Skip to content

yashpawar6849/first-application-on-Google-Kubernetes-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Google Kubernetes Engine (GKE) ☸️

A beginner-friendly, interactive codelab built in the style of Google Codelabs covering everything from containers to deploying, scaling, and updating a live app on GKE.

Made with GKE Beginner Friendly License: MIT

Create GKE Cluster


About 📖

This codelab walks complete beginners through deploying their very first containerized application on Google Kubernetes Engine (GKE). No prior Kubernetes or cloud experience required.

What you'll learn:

  • Why containers exist and what problem they solve.
  • What Kubernetes and GKE are (in plain English).
  • Core concepts: Pods, Deployments, Services, Nodes.
  • How to create a GKE cluster using Cloud Shell.
  • How to deploy, expose, scale, and update an app.
  • How to perform a zero-downtime rolling update.

Format: Interactive step-by-step codelab · 8 steps · ~30 minutes


Project Structure 🗂️

gke-codelab/
├── index.html      ← Standalone interactive codelab (open in any browser)
├── images/         ← Screenshots of commands executed.
└── README.md       ← You are here

Live Walkthrough 🖥️

Below is a full walkthrough of all the commands executed during this codelab, with real output screenshots.


Step 1: Create a GKE Cluster

Creates a 2-node GKE cluster in us-central1-a. The Kubernetes Engine API is auto-enabled on first run.

gcloud container clusters create my-first-cluster \
  --num-nodes=2 \
  --zone=us-central1-a

Create GKE Cluster

Cluster my-first-cluster created with 2 nodes, running Kubernetes v1.34.3-gke, STATUS: RUNNING


Step 2: Connect kubectl to the Cluster

Configures kubectl to point at the newly created cluster.

gcloud container clusters get-credentials my-first-cluster \
  --zone=us-central1-a

Get Credentials


Step 3: Verify Nodes are Ready

kubectl get nodes

Get Nodes

Both nodes show STATUS: Ready the cluster is healthy and ready for workloads.


Step 4: Deploy the App

Creates a Deployment running the hello-app:1.0 container image.

kubectl create deployment hello-app \
  --image=gcr.io/google-samples/hello-app:1.0

Create Deployment


Step 5: Verify Pod is Running

kubectl get pods

Get Pods

Pod hello-app-6f65bf88... is Running with 0 restarts ✅


Step 6: Expose the App to the Internet

Creates a LoadBalancer Service that gives the app a public IP.

kubectl expose deployment hello-app \
  --type=LoadBalancer \
  --port=80 \
  --target-port=8080

Expose Service


Step 7: Get the Public IP

kubectl get service hello-app --watch

Get Service

External IP assigned: 34.41.57.97 app is now live on the internet 🌐


Step 8: App Live: Version 1.0

Opening the external IP in a browser shows the running app:

Hello World v1

Version: 1.0.0 · Hostname: hello-app-6f65bf884d-trk2m


Step 9: Scale to 3 Replicas

kubectl scale deployment hello-app --replicas=3

Scale Replicas

One command to go from 1 Pod to 3 GKE load balances across all three automatically.


Step 10: Verify 3 Pods + Update Image

Confirms 3 Pods are running, then updates to hello-app:2.0:

kubectl get pods
kubectl set image deployment/hello-app \
  hello-app=gcr.io/google-samples/hello-app:2.0

Scale and Update


Step 11: Rolling Update Completes

kubectl rollout status deployment/hello-app

Rollout Status

deployment "hello-app" successfully rolled out — zero downtime ✅


Step 12: App Live: Version 2.0

After the rolling update, refreshing the browser shows the new version:

Hello World v2

Version: 2.0.0 · New Pod hostname confirms the update rolled out successfully


Step 13: Clean Up

Deletes the Service and the cluster to avoid ongoing charges.

kubectl delete service hello-app

gcloud container clusters delete my-first-cluster \
  --zone=us-central1-a

Cleanup

Service deleted · Cluster my-first-cluster deleted from us-central1-a


Prerequisites 📋

Requirement Details
Google Account Gmail works
Google Cloud Project Create one here $300 free credits for new accounts
Cloud Shell Browser-based terminal, no local install needed
Billing enabled Required for GKE cluster creation

Cost 💰

This codelab costs approximately $0.10–$0.30 to complete. All resources are deleted in the final cleanup step.


What's Next 🗺️

After completing this codelab, explore:

Topic Resource
ConfigMaps & Secrets kubernetes.io/docs
Ingress & Gateway API GKE Docs
Cluster Autoscaler GKE Docs
Helm helm.sh
CKA Certification cncf.io/certification/cka
Google Cloud Skills Boost cloudskillsboost.google

License 📄

This project is open source and available under the MIT License.

About

This codelab walks you through deploying your very first application on Google Kubernetes Engine (GKE).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages