Kubernetes Deployments define the desired number and state of application pods, then rely on ReplicaSets to keep that setup running. They also make rolling updates and rollbacks easier, while helping replace failed pods—handy when an app needs steady service without manual pod management.

Multiple Choice

Which object is used to manage the deployment of a set of replica pods in Kubernetes?

The Deployment object is used to manage the deployment of a set of replica pods in Kubernetes. It provides declarative updates to applications, enabling you to describe the desired state for your pods, and it works to maintain that state. When you create a Deployment, it automatically creates a ReplicaSet, which in turn manages the actual pods that are running. Deployments are particularly useful for handling rolling updates and rollbacks, allowing for an efficient way to update an application without downtime. They manage the lifecycle of the pods and ensure that the specified number of replicas are always running, handling failures by automatically recreating pods as necessary. While a ReplicaSet itself can manage a specified number of pods, it does not provide the more advanced features that a Deployment offers, such as easy updates and rollbacks. Other objects like DaemonSet and StatefulSet serve different purposes unrelated to standard deployment scenarios. DaemonSet ensures that a copy of a pod runs on all or some nodes, while StatefulSet is used for managing stateful applications that require stable network identities and persistent storage.

Kubernetes Deployments: How They Keep Applications Running

A Kubernetes application rarely stays still. A team may release a new version, change a configuration setting, or need more copies of a service as traffic grows. Kubernetes uses several workload objects to manage these situations, and the Deployment is the usual choice for running and updating a set of matching, stateless Pods.

A Deployment lets you describe the state you want, such as “run three copies of this web service.” Kubernetes then works to keep the cluster close to that description. If a Pod stops responding or disappears with a failed node, Kubernetes can create a replacement. If a new application version is ready, the Deployment can roll it out in a controlled way.

That simple idea—declare a desired state, then let the system maintain it—is central to how Kubernetes manages applications.

Start with the Pod

A Pod is Kubernetes’ smallest deployable unit. It holds one or more containers that share resources such as network access and storage. In a common web service, a Pod might contain a single application container.

But a Pod on its own isn’t much of a manager. If someone deletes it, the Pod doesn’t recreate itself. If a node fails, the Pod may stop running there, but it won’t independently arrange a replacement on another node. To keep a service available, Kubernetes needs a higher-level object to watch over its Pods.

That’s where the workload controllers come in. A Deployment manages Pods indirectly through a ReplicaSet. The ReplicaSet tracks the number of matching Pods and creates or removes them as needed. The Deployment manages the ReplicaSet’s broader lifecycle, including changes to the application’s desired state.

Think of the Deployment as the manager setting the plan, while the ReplicaSet keeps the day-to-day head count.

What a Deployment actually manages

A Deployment describes a desired state using a declarative configuration. Rather than issuing a long series of commands to start, replace, and update individual Pods, an operator specifies what the application should look like. The Kubernetes control plane compares that description with the cluster’s current state and takes action when they differ.

For example, a basic Deployment might request three replicas of a web application. If only two matching Pods are running, the ReplicaSet can create another. If four are running, it can remove one. This ongoing adjustment is called reconciliation: Kubernetes repeatedly checks the system and works toward the declared state.

A simplified YAML definition might look like this:


apiVersion: apps/v1

kind: Deployment

metadata:

name: web

spec:

replicas: 3

selector:

matchLabels:

app: web

template:

metadata:

labels:

app: web

spec:

containers:

- name: web

image: nginx:1.27

ports:

- containerPort: 80

The replicas field sets the desired Pod count. The selector tells the Deployment which Pods belong to it, while the template describes the Pods it should create. Notice that the labels in the template match the selector. That connection matters: labels and selectors are how Kubernetes associates objects with one another.

A Deployment doesn’t usually expose an application to network traffic by itself. A Service commonly handles that job, providing a stable way to reach a changing group of Pods. These objects work together, but they have distinct roles: the Deployment manages application instances; the Service directs network traffic to them.

The ReplicaSet is still part of the picture

Because a Deployment creates and manages ReplicaSets, it can be tempting to skip the Deployment and create a ReplicaSet directly. A ReplicaSet can maintain a specified number of matching Pods, so it handles an important part of the work.

However, the ReplicaSet alone doesn’t provide the same convenient rollout controls. A Deployment creates a new ReplicaSet when the Pod template changes, then manages the transition from the old version to the new one. It also records rollout history, which supports rollbacks when an update causes trouble.

In other words, a ReplicaSet is a useful building block, but a Deployment is usually the higher-level tool for managing standard application releases. Most users interact with the Deployment and let it handle the ReplicaSets beneath it.

Updates without replacing everything at once

Changing a container image in a Deployment can trigger a rolling update. Kubernetes gradually starts Pods with the new version while retiring Pods with the old version. The rollout settings can control how many Pods may be unavailable or how many extra Pods may run during the transition.

This gradual approach can help keep an application available during a release. It isn’t a guarantee that every update will be seamless—application health checks, capacity, dependencies, and configuration all matter—but it gives Kubernetes a structured way to replace one version with another.

If the new version behaves badly, a Deployment can roll back to an earlier revision. This is useful when a release introduces a bug that wasn’t apparent during development. The rollback returns the workload to a previous Pod template; it doesn’t automatically reverse every database change or external system update, so those need their own safeguards.

Common commands include:


kubectl get deployments

kubectl describe deployment web

kubectl rollout status deployment/web

kubectl rollout history deployment/web

kubectl rollout undo deployment/web

These commands help inspect the Deployment, track rollout progress, review its recorded revisions, and return to a previous version. The details are useful, but the underlying idea is straightforward: the Deployment keeps track of the desired application version and coordinates changes to its Pods.

Not every workload needs a Deployment

Kubernetes has several workload objects because applications don’t all behave alike. A Deployment fits many stateless services, where Pods are largely interchangeable. If one web server Pod vanishes, another can take its place without needing the same identity or local data.

A DaemonSet has a different job. It ensures that a Pod runs on each selected node, or on a subset of nodes. Logging agents and node-monitoring tools are common examples: each machine may need its own copy.

A StatefulSet is designed for applications that need stable identities, ordered deployment, or persistent storage. Databases and clustered systems may rely on those features. Unlike interchangeable web Pods, a stateful workload may care which Pod is which and what storage is attached to it.

These objects can all create or manage Pods, but they solve different problems. Choosing the right one depends on the workload’s needs—not just on how many copies it should run.

A few details worth watching

A Deployment’s selector and Pod labels should be planned carefully. If they don’t match, the Deployment may fail to manage the Pods described in its template. Kubernetes also expects the selector to remain consistent after creation, so it’s not a field to change casually.

Resource requests and limits matter, too. A Deployment can ask for several replicas, but the cluster still needs enough CPU and memory to schedule them. If there isn’t room, some Pods may remain pending. Scaling a number in YAML is easy; making sure the cluster can support that number is the less glamorous—and very real—part.

Finally, availability depends on more than replica count. Readiness probes can help Kubernetes distinguish a running container from one that is ready to receive traffic. Pod disruption budgets can limit how many replicas are voluntarily unavailable during certain maintenance operations. These features don’t replace sound application design, but they help a Deployment fit into a more resilient system.

The useful mental model

A Kubernetes Deployment is a declarative controller for a set of application Pods. You describe the desired state; Kubernetes works to maintain it. The Deployment manages ReplicaSets, and those ReplicaSets manage the actual Pod count. That structure supports scaling, rolling updates, and rollbacks for many common stateless services.

Once the pieces click, the hierarchy feels less like Kubernetes jargon and more like a sensible chain of responsibility: the Deployment handles the release, the ReplicaSet tracks the count, and the Pods run the containers. It’s a small architecture with a big payoff—especially when an application needs to keep running while its surroundings change.