K8s — Replica Controller and Replica Set

What is Replication?

When we think about pods high availability, load balancing, and scaling replication come into the picture. Kubernetes having the provision to define replicas of your pod along with its monitoring in the k8s cluster.

If we define 3 desired pods at the start of the application it's the responsibility of Kubernetes that monitors desired pods and actual running pods. In case if any pod gets crashed / back of with error, Kubernetes takes care of creating a new one and managing its traffic as well.

Replica Set vs Replica Controller

A replica set is a new version of the replica controller, Only difference here I found is selector support available with the replica set.

Replica Controller

Advantage od selectors

It provides the advantage to use a set-based selector-like environment in (Dev / QA / Production) or tire notin(frontend/ backend) which can use with a replication controller.

When to use replica Set?

Most cases replicas set are using with deployment as it ensures a specific set of pod replicas are running. unless we required custom update and orchestration

Replica set command

kubectl get replicaset

kubectl describe replicaset <name of replica set>

kubectl apply -f replica.yaml

kubectl delete replicaset <name of replica set>

kubectl edit replicaset <name of replica set>

kubectl scale replicasetreplicas=5 <name of replica set>


This article shows what is replica controller and replica set, Why use it? How to use it and what is the difference between the replica set and the replica controller.