# Working with REPICASETS & REPLICATION CONTROLLER

handson

## what is REPLICATION CONTROLLER ?

Here's an example to illustrate the concept of a Replication Controller:

Let's say you have an application that requires three instances (pods) running at all times for high availability and load distribution. You can create a Replication Controller with the desired configuration, specifying the number of replicas as three.

The Replication Controller will then monitor the pods. If any of the pods fail or get terminated, the Replication Controller will automatically create a new pod to maintain the desired count of three pods. Similarly, if you decide to scale up the application and increase the desired number of replicas to five, the Replication Controller will create two additional pods to reach the desired count  

## what is REPLICASET ?

To explain ReplicaSet in simple words, let's consider an example:

Imagine you have a web application that requires three instances (pods) running to handle incoming traffic and provide high availability. You can create a ReplicaSet with a desired replica count of three.

The ReplicaSet continuously monitors the status of the pods it manages. If any of the pods fail or get terminated, the ReplicaSet takes action to maintain the desired count of three replicas. It automatically creates a new pod to replace the failed or terminated pod.

ReplicaSets also allow you to scale your application horizontally. If you decide to increase the desired replica count to five to handle increased traffic, the ReplicaSet creates additional pods to reach the desired count. Similarly, if you decrease the count, excess pods are automatically terminated to match the desired count.

## how to check the number of replicasets on system ?

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685966726490/316426a2-06fb-4429-9322-9fbe1242927b.png align="center")

##   
**how to check which images are used in making the pods in that particular replica set ?**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685967052072/9819a01f-9d21-4456-988c-ac7db4c51845.png align="center")

## how to make the replicaset using yaml file ?

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685967619639/79ee5033-08bd-41bb-b0fd-6a47410b5c2c.png align="center")

## how to change the image used in replica set ?

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685968090028/cfd6ca96-112f-468b-959c-e0dd9a0f3eba.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685968113195/93109701-4d63-472b-a765-4b8863836b28.png align="center")

## How to scale the replicaset ?

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685968261605/9d6d35bf-ba79-4ccb-9f63-91aadd4c6427.png align="center")
