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