liveBook · Manning

ReplicaSet

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A ReplicaSet is a Kubernetes object that maintains a specified number of equivalent pod replicas through a control loop.

A ReplicaSet is a Kubernetes object whose control loop maintains a specified number of equivalent pods. It is the layer between a Deployment and the pods running an application. section 1.4 section 1.4.1

For a stateless application, a Deployment creates or updates a ReplicaSet to maintain the desired pod count. A ReplicaSet represents a specific application version; changing a Deployment’s image creates a new ReplicaSet as the rollout moves between versions. section 5.1.2

To see the relationship in a cluster:

  • Create a Deployment manifest with `kubectl create deploy nginx --image nginx --dry-run=client -o yaml > deploy.yaml`, then run `kubectl create -f deploy.yaml`. section 5.1.2
  • Run `kubectl get deploy` and `kubectl get rs`. Compare the Deployment’s READY count with the ReplicaSet’s DESIRED, CURRENT, and READY columns. section 5.1.2
root@kind-control-plane:/# kubectl get rs
NAME                DESIRED   CURRENT   READY   AGE
apache-698b8cccbd   5         5         5       28m
apache-74f79bcc68   0         0         0       45m

This output shows one ReplicaSet with five desired, current, and ready pods alongside another with zero. Check all three counts rather than assuming every listed ReplicaSet is running pods. section 5.1.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains the control-loop purpose, replica counts, and version transitions without detailing controller internals.
Examples
Uses a Deployment manifest and `kubectl get rs` output showing five active replicas and a ReplicaSet at zero.
What it assumes
Assumes access to a Kubernetes cluster through kubectl while establishing the relationship among Deployments, ReplicaSets, and pods.
What you can do after
Operate/configure it through a Deployment and verify replica counts with `kubectl get deploy` and `kubectl get rs`.
How it connects
Connects ReplicaSets to Deployments, pods, stateless workloads, and rolling updates.

Also explained in

Compare how 5 books explain ReplicaSet →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.