Cloud Native 17 min read

Understanding Kubernetes Deployments, ReplicaSets, Pods and Advanced Deployment Strategies

This article explains how Kubernetes uses Deployments, ReplicaSets and Pods to manage containerized applications, covering basic object creation, scaling, rolling updates, readiness probes, rollback, maxSurge/maxUnavailable settings, and advanced strategies such as blue‑green and canary deployments.

Cloud Native Technology Community
Cloud Native Technology Community
Cloud Native Technology Community
Understanding Kubernetes Deployments, ReplicaSets, Pods and Advanced Deployment Strategies

Kubernetes manages containerized applications through a set of declarative objects. The smallest unit is a Pod , which can contain one or more containers that share network and storage resources.

A Deployment describes the desired state of an application and automatically creates a ReplicaSet to maintain the required number of Pods. The ReplicaSet ensures that the specified number of Pods with matching labels are always running.

Typical commands:

$ kubectl run web --image=nginx
deployment.apps/web created
$ kubectl get all

show the created Deployment, ReplicaSet and Pod objects.

To create a single‑container Pod directly, you can apply a YAML manifest such as:

# pod-nginx.yml
apiVersion: v1
kind: Pod
metadata:
  name: web
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80

Scaling is handled by the ReplicaSet . Changing the replicas field creates or deletes Pods to match the desired count, and the controller continuously monitors node health to replace failed Pods.

When a Deployment is updated (e.g., a new image version), Kubernetes creates a new ReplicaSet with zero replicas and gradually shifts traffic by increasing the new ReplicaSet’s replica count while decreasing the old one. This rolling update respects the maxSurge and maxUnavailable parameters, which control how many extra Pods may be created and how many Pods may be unavailable during the update.

Readiness probes (command, HTTP, or TCP checks) determine when a Pod is considered ready to receive traffic. If a probe continuously fails, the Deployment pauses, keeping the previous version running until the issue is resolved.

Rollback is performed with kubectl rollout undo deployment <name> , which restores the previous ReplicaSet and its Pods.

Advanced deployment strategies:

Blue‑Green: Deploy a new version in a separate Deployment and switch a Service’s selector from the old to the new Deployment instantly.

Canary: Gradually shift a small percentage of traffic to the new version by labeling a subset of Pods and adjusting the Service selector.

Service objects provide stable ClusterIP endpoints and use label selectors to route traffic to the appropriate Pods, automatically adapting to rolling updates without manual reconfiguration.

In summary, Kubernetes’ declarative model, combined with Deployments, ReplicaSets, readiness probes, and flexible Service selectors, enables safe, automated, and observable rollouts, reducing downtime and allowing frequent releases.

deploymentkubernetesPodrolling updateReplicaSetblue-greencanary
Cloud Native Technology Community
Written by

Cloud Native Technology Community

The Cloud Native Technology Community, part of the CNBPA Cloud Native Technology Practice Alliance, focuses on evangelizing cutting‑edge cloud‑native technologies and practical implementations. It shares in‑depth content, case studies, and event/meetup information on containers, Kubernetes, DevOps, Service Mesh, and other cloud‑native tech, along with updates from the CNBPA alliance.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.