Back to Glossary
Workloads

ReplicaSet

A controller that ensures a specified number of Pod replicas are running at any given time.

What is ReplicaSet?

A ReplicaSet's sole responsibility is maintaining a stable count of Pod replicas. It watches Pods matching its selector and creates or deletes Pods to match the desired replica count. If a Pod fails, the ReplicaSet replaces it; if there are too many matching Pods, it deletes the excess. ReplicaSets are the lower-level primitive that Deployments build on — most users interact with Deployments rather than ReplicaSets directly.

Each time you update a Deployment (change image, resources, labels), it creates a new ReplicaSet for the updated template while scaling down the old one. Old ReplicaSets are retained according to spec.revisionHistoryLimit (default 10) to enable rollbacks. These retained ReplicaSets have replicas: 0 but still exist as API objects, consuming etcd space.

Direct use of ReplicaSets (without a Deployment) is rare and generally discouraged because it lacks rollout and rollback capabilities. The main exception is when a custom controller manages rollout logic itself and creates ReplicaSets directly as its scaling primitive.

Example

# List all ReplicaSets in a namespace, including old ones from Deployment rollouts
kubectl get replicasets -n production

# Check which ReplicaSet a Pod belongs to
kubectl get pod my-pod -n production -o jsonpath='{.metadata.ownerReferences}'

# Manually scale a standalone ReplicaSet
kubectl scale replicaset my-rs --replicas=5 -n staging

Cost & Waste Implications

Stale ReplicaSets left by Deployment rollouts don't consume compute (replicas: 0) but do accumulate as API objects in etcd. A Deployment with many frequent rollouts and a high revisionHistoryLimit can accumulate dozens of zero-replica ReplicaSets. More critically, orphaned ReplicaSets with replicas > 0 (e.g., after a Deployment was deleted but its RS was not) waste compute.

KorPro— Kubernetes Cost Optimization

How KorPro Helps

KorPro detects orphaned ReplicaSets with non-zero replica counts (not owned by any active Deployment) and stale zero-replica ReplicaSets that have accumulated beyond a sensible revision history.

Scan Your Cluster Free

Stop Wasting Money on Orphaned Kubernetes Resources

KorPro connects to your clusters across GCP, AWS, and Azure — no agents, no installation — and surfaces every orphaned resource with its monthly cost estimate.