Replica Set
Replica set, also termed as rs
in short, is almost same as the replication controller is, only with a single difference. The replica set are also known as next generation replication controller. The only difference between replica set and replication controller is the selector types.
The replication controller supports equality based selectors whereas the replica set supports equality based as well as set based selectors.
Equality based Selectors
Equality based selectors allow filtering by label keys and values. Matching objects must satisfy all of the specified label constraints, though they may have additional labels as well.
Three operators used in set based equality based selectors are =
, ==
, !=
. The first two represent equality (and are simply synonyms), while the latter represents inequality.
For example, if we provide the following selectors:env = prod
tier != frontend
Here, we’ll select all resources with key equal to environment
and value equal to production
. The latter selects all resources with key equal to tier
and value distinct from frontend
, and all resources with no labels with the tier
key.
One usage scenario for equality-based label requirement is for Pods to specify node selection criteria.
Set Based Selectors
Unlike Equality based, Set-based label selectors allow filtering keys according to a set of values.
Three kinds of operators used in set-based selectors are in
, notin
, exists
(only the key identifier).
For example, if we provide the following selectors:env in (prod, qa)
tier notin (frontend, backend)
partition
Here, in the first selector will selects all resources with key equal to environment
and value equal to production
or qa
.
The second example selects all resources with key equal to tier
and values other than frontend
and backend
, and all resources with no labels with the tier
key. The third example selects all resources including a label with key partition
; no values are checked.
The set-based label selector is a general form of equality since environment=production
is equivalent to environment in (production)
. Similarly for !=
and notin
.
The functionality of both Replica Controller and Replica Set is quiet the same – they are responsible to make sure that X number of pods with label that is equal to there label selector will be scheduled to different nodes on the cluster.
ReplicaSet is the next generation of Replication Controller. Replication controller is kinda imperative, but replica sets try to be as declarative as possible.
The difference should be insignificant in most cases. ReplicaSet has a generalized label selector. ReplicaSet should support all the features the replication controller supports.
ReplicaSet is a replacement for the Replica controller and supports richer expressions for the label selector. You can choose between 4 values of operators In, NotIn, Exists, DoesNotExist
The main difference between a Replica Set and a Replication Controller right now is the selector support.
No comments:
Post a Comment