• TechOps Examples
  • Posts
  • How to Use Kubernetes Deployments and Services to Manage Pods

How to Use Kubernetes Deployments and Services to Manage Pods

TechOps Examples

Hey — It's Govardhana MK 👋

Welcome to another technical edition.

Every Tuesday – You’ll receive a free edition with a byte-size use case, remote job opportunities, top news, tools, and articles.

Every Thursday and Saturday – You’ll receive a special edition with a deep dive use case, remote job opportunities, and articles.

Your cloud may be backed up, but can it recover from an outage or attack?

Backups protect data, but they don’t keep services running. Without infrastructure, configurations, and cloud resources, recovery stalls and downtime continues.

Traditional disaster recovery wasn’t built for cloud-native environments. Gartner’s new Cloud Application Infrastructure Recovery (CAIRS) category signals a shift: recovery now requires rebuilding infrastructure, not just restoring data.

What you’ll get:

  • Why traditional backup fails in multi-cloud environments

  • How CAIRS shifts recovery from data to infrastructure

  • A practical framework for automated recovery

👀 Remote Jobs

Powered by: Jobsurface.com

📚️ Resources

Looking to promote your company, product, service, or event to 60,000+ Cloud Native Professionals? Let's work together. Advertise With Us

🧠 DEEP DIVE USE CASE

How to Use Kubernetes Deployments and Services to Manage Pods

As soon as you move from running a single container to operating a real application in a cluster, complexity increases. Pods are dynamic by design. They can be recreated, rescheduled, scaled horizontally, or terminated at any time based on desired state and cluster conditions.

You immediately face two practical challenges: how to keep the right number of Pods running, and how to make them consistently reachable despite restarts, rescheduling, or scaling events.

Understanding how Kubernetes Deployments and Services work is critical in this aspect.

What is a Kubernetes Deployment

A Kubernetes Deployment is a way to tell the cluster how your application Pods should run and how many of them should exist.

Instead of manually creating Pods one by one, you define a Deployment with a desired number of replicas and a Pod template. Kubernetes then ensures that the specified number of identical Pods are always running.

  • If a Pod crashes, it is automatically recreated.

  • If you scale the Deployment, more Pods are added or removed.

  • If you update the container image, Kubernetes updates the Pods in a controlled way.

So practically, a Deployment is responsible for maintaining the desired state of your application Pods over time.

How a Deployment Becomes Running Pods

  • When you apply a Deployment, the manifest is sent to the API server, validated, and stored in etcd as part of the cluster’s desired state.

  • The Deployment controller watches the API server, detects the new Deployment object, and creates a ReplicaSet based on the defined Pod template and replica count.

  • The ReplicaSet controller compares desired replicas with the current state and creates the required Pod objects, which are stored in the API server. At this stage, Pods exist only as definitions in the control plane.

  • The Scheduler watches for Pods without a nodeName, evaluates worker nodes based on resource availability and constraints, and assigns each Pod to the most suitable node.

  • The kubelet on the selected worker node detects the assigned Pod, reads its specification, and instructs the container runtime to pull the image and start the containers inside the Pod.

  • Once the containers start successfully, the Pod transitions to the Running state, and Kubernetes continues reconciling actual state with the declared configuration to maintain health and replica count.

With this basic understanding, let us now see how Kubernetes Services are used in two different ways in production environments and which one to pick when.

🔴 Get the Ultimate Infrastructure as Code White Paper for Multi Cloud (From Firefly - built on Gartner’s new Cloud Application Infrastructure Recovery 'CAIRS' framework.)

Upgrade to Paid to read the rest.

Become a paying subscriber to get access to this post and other subscriber-only content.

Already a paying subscriber? Sign In.

Paid subscriptions get you:

  • • Access to archive of 250+ use cases
  • • Deep Dive use case editions (Thursdays and Saturdays)
  • • Access to Private Discord Community
  • • Invitations to monthly Zoom calls for use case discussions and industry leaders meetups
  • • Quarterly 1:1 'Ask Me Anything' power session