Desired replicas vs actual replicas
📖 Scenario: You are managing a Kubernetes deployment for a web application. You want to check if the number of running pods matches the desired number of replicas specified in the deployment configuration.
🎯 Goal: Build a simple script that stores the desired number of replicas and the actual number of running pods, compares them, and prints whether the deployment is healthy or not.
📋 What You'll Learn
Create a variable
desired_replicas with the exact value 3Create a variable
actual_replicas with the exact value 2Write a comparison to check if
desired_replicas equals actual_replicasPrint
"Deployment is healthy" if they match, otherwise print "Deployment is not healthy"💡 Why This Matters
🌍 Real World
Kubernetes operators and DevOps engineers often need to verify if the actual running pods match the desired replicas to ensure application availability.
💼 Career
Understanding how to compare desired and actual states is fundamental for monitoring and troubleshooting Kubernetes deployments in real jobs.
Progress0 / 4 steps