In Kubernetes, ReplicaSet and ReplicationController are resources used to maintain a specified number of running Pods. They monitor Pods and create or remove Pods to maintain the desired replica count. ReplicationController is an older Kubernetes resource, while ReplicaSet is its newer and more flexible replacement.
ReplicationController
- A ReplicationController is a Kubernetes resource that ensures a specified number of Pod replicas are running at any given time.
- If a Pod managed by the ReplicationController fails or is deleted, the ReplicationController creates a replacement Pod.
For example, if the desired number of replicas is 3, the ReplicationController continuously tries to maintain 3 matching Pods.

ReplicationController uses equality-based selectors to identify the Pods it manages.
For example, the selector:
selector:app: nginx
matches Pods with the following label:
labels:app: nginx
ReplicaSet
- A ReplicaSet is a Kubernetes resource that maintains a specified number of identical Pod replicas.
- It performs the same basic replication and self-healing functions as a ReplicationController but provides more flexible Pod selection.
A ReplicaSet supports the following selector types:
matchLabelsmatchExpressions
For example, a ReplicaSet can use matchLabels:
selector:matchLabels:app: nginx
It can also use set-based selectors through matchExpressions:
selector:matchExpressions:- key: environmentoperator: Invalues:- production- staging
This allows the ReplicaSet to select Pods based on more complex conditions.
Key Difference
Although both resources maintain the desired number of Pods, they differ in their selector capabilities and usage.
| Feature | ReplicaSet | ReplicationController |
|---|---|---|
| Purpose | Maintains the desired number of Pods | Maintains the desired number of Pods |
| API version | apps/v1 | v1 |
| Selector type | Equality-based and set-based | Equality-based |
matchLabels | Supported | Not supported |
matchExpressions | Supported | Not supported |
| Self-healing | Yes | Yes |
| Scaling | Yes | Yes |
| Rolling updates | No, not by itself | No |
| Used by Deployment | Yes | No |
| Current usage | Preferred over ReplicationController | Legacy |
| Flexibility | More flexible | Less flexible |
- For new Kubernetes applications, ReplicaSet is preferred over ReplicationController because it provides more flexible selectors and integrates with Deployments.
- However, in most application deployments, you should use a Deployment instead of creating a ReplicaSet directly. A Deployment manages ReplicaSets and provides rollout and rollback capabilities.