Replica Sets

Replica Sets are declared in the same way as Replication Controller except that they have more options for the selectors. The Selector is mandatory for Replica sets as match labels you can provide the pod labels to query the pods to match with the replica count.

Let’s look at this example below:

 

Here we can see, the API version is apps v1, the kind is ReplicaSet, and then we will be defining what is our ReplicaSet name under the spec section we can define the number of replicas, and under selectors match labels we will define what are our pod labels which need to be considered for the replica counts. Under the template section, we can provide our pod template which includes the containers, images, and labels, under the selector section not only the matching label we can use match expressions as well to configure different conditions for the selector. In this particular example, the app label must be engine x or frontend the environment label if it exists must not be produced.

Kuberneters – Difference Between Replicaset and Replication Controller

Pre-requisite: Kubernetes

Kubernetes is also known as K8s is an open-source container orchestration tool developed by google which is used for automating software deployment, scaling, and management. Currently, it is being maintained by the cloud native computing foundation(CNCF).

K8s has two versions, the original Kubernetes and a mini version which is known as minikube.

Similar Reads

Replication:

Typically we want to replicate our containers i.e. our application for several reasons which include reliability, load balancing, and scaling. By having multiple versions of the application we prevent problems if one or more pods fail....

Replication Controller:

The Replication Controller is the original form of Replication in Kubernetes. It is been replaced by Replica sets. But, as the Replication Controller is widely used it is worth understanding what is it and how it works....

Replica Sets:

Replica Sets are declared in the same way as Replication Controller except that they have more options for the selectors. The Selector is mandatory for Replica sets as match labels you can provide the pod labels to query the pods to match with the replica count....

Replication Controller Vs Replica Set:

Replication Controller   Replica Set   The Replication Controller is the original form of replication in Kubernetes ReplicaSets are a higher-level API that gives the ability to easily run multiple instances of a given pod The Replication Controller uses equality-based selectors to manage the pods. ReplicaSets Controller uses set-based selectors to manage the pods. The rolling-update command works with Replication Controllers The rolling-update command won’t work with ReplicaSets. Replica Controller is deprecated and replaced by ReplicaSets. Deployments are recommended over ReplicaSets....