3

I understand the difference between ReplicaSet and ReplicationController, of former being Set based and the latter Equality based. What I want to know is why was a newer implementation (Read ReplicaSet) introduced when the older ReplicationController achieves the same functionality.

Vinodh Nagarajaiah
  • 153
  • 1
  • 3
  • 6
  • in this post you can find a good comparison [What is the difference between ReplicaSet and ReplicationController?](https://stackoverflow.com/a/41190819/5571750) – Semah Mhamdi Mar 12 '19 at 15:19
  • Thanks for the share, however, I had viewed that particular thread before too. That answers the difference between RC and RS but I intend to know why was RS introduced while functionality wise ReplicationController achieves the same. – Vinodh Nagarajaiah Mar 12 '19 at 15:56

3 Answers3

1

ReplicaSet is usually not standalone, these are owned by Deployment. A single Deployment can have many ReplicaSets in its life cycle as new Version deployment added one more ReplicaSet.

Deployment allows us to rollback to previous stable releases if required.

Akash Sharma
  • 721
  • 3
  • 6
1

Replicasets is updated version of Replication controller

In Replication controller there equality-based selectors

In Replicasets there is set-based selectors

Replicasets also work with deployment so when you do simple deployment in kubernetes replicasets automatically generated and managed.so deployment owned replicasets.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
1

I think this can be summed up to the 3 points below.

1 ) ReplicaSet is a replacement for the Replica controller and supports richer expressions for the label selector. You can choose between four values of operators In, NotIn, Exists, DoesNotExist - see Set-based requirement.

2 ) There is a small differnece in the syntax - ReplicaSet which contains matchLabels field under the selector:

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx
spec:
  replicas: 3
  selector:
    matchLabels: #<-- This was added
      tier: nginx

3 ) When you see Replica Controller is mentioned in one the docs or other tutorials - refer to it as ReplicaSet AND consider using Deployment instead.

Rot-man
  • 18,045
  • 12
  • 118
  • 124