fbpx

πŸš€ The Role of Kubernetes in DevOps – A Real-Time Use Case

If you are new to DevOps, you may have heard people talk about Kubernetes. But what exactly is Kubernetes? And why is it so important in the DevOps world?
Let’s break it down in a simple way and explore a Kubernetes DevOps usecase through a real-world example to understand how it works in action.

🧩 What is Kubernetes?
Kubernetes (K8s) is an open-source platform used to manage containers. A container is a lightweight software unit that packages your application code along with everything it needs to runβ€”like libraries, runtime, and system tools.
Kubernetes helps in:
  • Running applications in containers
  • Scaling applications up or down
  • Automatically restarting if an app crashes
  • Balancing traffic so no server is overloaded
Think of Kubernetes as a robotic manager that automatically handles your applications for you.
πŸ§ͺ Why Do DevOps Teams Use Kubernetes?
In DevOps, the goal is to deliver software quickly and reliably. Kubernetes fits into this process by:
  • Automating deployment and scaling
  • Making applications easier to move across environments (dev, test, prod)
  • Reducing downtime with self-healing
  • Managing microservices effectively
This makes development and operations teams work more efficiently together.
πŸ” Real-Time Use Case – Deploying a Web App with Kubernetes

Let’s take an example to understand the real-time use of Kubernetes in a DevOps setup.

Scenario: A Company Deploys an E-Commerce Website
Imagine an online store called ShopKart. The developers build the website using microservicesβ€”one for products, one for cart, and one for payments.
Here’s how Kubernetes helps in a DevOps pipeline:
1. Containerizing the Application
Each microservice is packaged into a Docker container.
Example:
  • product-service:1.0
  • cart-service:1.0
  • payment-service:1.0
These containers are stored in a container registry like DockerHub or Azure Container Registry (ACR).
2. Creating a Kubernetes Cluster
The DevOps team creates a Kubernetes cluster (using platforms like AWS EKS, Azure AKS, or GCP GKE) to host the application.
A cluster is a group of machines (nodes) managed by Kubernetes.
3. Deploying the Application Using YAML

To tell Kubernetes what to deploy and how, we use a configuration file written in YAML.

Here is an example YAML file to deploy the Product Service:

apiVersion: apps/v1
kind: Deployment
metadata:
Β  Β  Β  Β name: product-deployment
spec:
Β  Β  Β  Β replicas: 3
Β  Β  Β  Β selector:
Β  Β  Β  Β  Β  Β  matchLabels:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β app: product
Β  Β  Β  Β template:
Β  Β  Β  Β  Β  Β  Β metadata:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  labels:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  app: product
Β  Β  Β  Β  Β  Β  Β spec:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β containers:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β – name: product
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  image: shopkart/product-service:1.0
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  ports:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  – containerPort: 8080

🧾 Let’s break it down:
Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β SectionExplanation
apiVersion: apps/v1This defines which version of the Kubernetes API we are using for the deployment.
kind: DeploymentWe are creating a Deployment – which helps manage a set of identical pods.
metadata:Information like the name of the deployment (product-deployment).
replicas: 3We want 3 instances (pods) of the product microservice running.
selector:Tells Kubernetes how to find the pods related to this deployment using labels.
template:The actual configuration of the pods (like a template for them).
containers:Inside the pod, we define a container:
– name: productThe container’s name.
image: shopkart/product-service:1.0The Docker image to run inside this container.
ports:Exposes port 8080, which the app will use inside the container.

This YAML file helps automate the deployment of your app with just one command:

kubectl apply -f product-deployment.yaml

4. Service and Load Balancing

To make the app accessible, Kubernetes uses a Service object, which routes traffic to the correct pods and balances the load.

5. Rolling Updates and Rollbacks
When version product-service:2.0 is ready, the DevOps team updates the image in the YAML and reapplies it. Kubernetes will roll out the update slowly, checking if everything works.
If something goes wrong? Just roll back to the previous version.
6. Auto-Scaling & Self-Healing
  • If user traffic increases (like during a festival sale), Kubernetes can add more pods automatically.
  • If a pod crashes, Kubernetes restores it immediately.
No manual steps are needed.
πŸ’‘ Summary – Why Kubernetes is a DevOps Hero
FeatureBenefit
YAML ConfigurationDefines app setup in a readable way
Container OrchestrationRuns and manages containers automatically
Auto-ScalingAdjusts resources based on traffic
Rolling UpdatesNo downtime during new releases
Self-HealingRecovers from crashes without human helpy
PortabilityWorks across cloud or on-prem
🧠 Final Thoughts
For any DevOps team working with modern apps, Kubernetes is a must-have tool. It helps automate deployment, scaling, and management of containerized apps.
If you’re starting in DevOps, begin with learning:
  • Docker (to create containers)
  • Kubernetes YAML (to manage them)
  • Use Minikube to practice locally
Then move to advanced tools like Helm and GitOps for real-world DevOps workflows.

βœ… Check Your Knowledge – Beginner Quiz on Kubernetes

Test yourself with these simple questions to see how well you understood the blog!

1 / 5

What is the main role of Kubernetes in DevOps?

2 / 5

What is the purpose of the replicas: 3 line in a Kubernetes YAML file?

3 / 5

Which command is used to apply a YAML file in Kubernetes?

4 / 5

What happens if a container crashes in a Kubernetes pod?

5 / 5

Which section in a YAML file tells Kubernetes which Docker image to use?

Your score is

The average score is 95%

0%

Devops Multi cloud Training

Choose the training style that fits your schedule β€” Self-Paced or Live Interactive Sessions. Both include hands-on projects, expert support, and lifetime access.

FeatureSelf-Paced TrainingLive Training
🎯 ModeπŸŽ₯Pre-Recorded SessionπŸ§‘β€πŸ«Live Class + Recordings
πŸ’Ό ProjectsπŸ•’ Weekend Real-Time ProjectsπŸ“… Weekdays + Weekend Real-Time Projects
❓ Doubt ClearingπŸ“ž Weekend Live Support Session🧠 Anytime Doubt Clearing Session
πŸ‘₯ Career Support & Mentorship❌ Noβœ… Yes
πŸŽ“ Global Certification Training❌ Noβœ… Yes
πŸ”‘ Access♾️ Lifetime Access♾️ Lifetime Access
πŸ’° Feesβ‚Ή4,999 (2 x β‚Ή2,500)β‚Ή7,999 (2 x β‚Ή4,000)
ℹ️ For More InfoExplore Self-Paced Training Explore Live Training

Leave a Comment

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

Open chat
Hello, Good day!!
How can we help you?