I am new in CKA, want to know the difference between Replication controller and the replica set
ReplicaSet is the object created by k8s that represents replication on particular pods. ReplicationController is the k8s piece of software in charge of overlook the replication sets and rules.
When you create a deployment, it creates a replica set representing your rules on replications. The replication controller is always checking those rules are fulfilled and trigger action if they are not, like creating a new replica of a pod, or killing some, etc.
@Mo’een sokkar --Replicaset were used in earlier version of k8s, where your controller can manage only the pods defined in your replicaset.spec.template.container object. Whereas replication controller is used nowadays and it can manage pods with its spec same like replicaset as well as other pods s(not defined in your spec )that matches the label as specified in matchLabels in replica controller spec.
@Sampathkaran it should be the otherway around.
@Mo’een sokkar, the purpose of a ReplicationController (RC) and a ReplicaSet (RS) is the same, but RC is an older and initial version of it.
apiVersion of an RC is
v1 where as for RS the
If you define a RS with
kind as ReplicationSet but apiVersion as
v1, the apiserver will throw an error saying it cannot find in v1.
The replicaSet is the new recommended way to setup.
The crucial part in the definition file for these two is the
In a ReplicaSet
spec section, a
selector can be specified; A ReplicaSet can also manage the pods that are not created by the pods created by it, but already existing before, as long as the pod labels match.
A selector is not a required field in a ReplicationController, but a must in RS with
Another difference between RC and RS is that RC uses
Equality based selectors whereas a RS can use a
More information you can read at https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors