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.

The Replication Controller is a structure that enables us to easily create multiple pods. If we make sure that a number of pods always exists. If a pod crashes, the Replication Controller replaces it with a new pod. The Replication Controller also provides other benefits such as the ability to scale the number of pods and to update or delete multiple pods with a single command.

This is how the ReplicationController.yml definition would look in the below-attached example screenshot.

Replication Controller Example

Here we can see the API version is v1 and the kind is Replication Controller.

So, here we will provide the name for the Replication Controller and under the spec, we will be defining how many replicas we want from the given pod definition under the template section. Under the template section, we will be providing the exact details that we have provided in a pod definition yml file that will include metadata labels and under the spec, we can define containers, init containers, different images, ports, different configmap volume mounts, environment variables all of those configurations basically related to pods we can provide it under the template section.

The Replication Controller can have an optional selector and spec, where we can provide the labels used in the pods which is used to label query over the pods that should match with the replica count. When the selector is not provided it will assume that the provided template labels will be used as the selector.

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....