Writing a ReplicationController Manifest
RepilcationController requires the following content to write a yaml file.
- apiVersion
- Kind
- spec
- selector
- template
- labels
- spec
Following is the sample yaml file to write the replication controller:
apiVersion: v1
kind: ReplicationController
metadata:
name: <replicationControllerName>
namespace: <nameSpaceName>
spec:
replicas: <noOfReplicas>
selector:
<key>: <value>
template: # POD Template
metadata:
name: <PODName>
labels:
<key>: <value>
spec:
- containers:
- name: <nameOfTheContainer>
image: <imageName>
ports:
- containerPort: <containerPort>
Kubernetes
template:
metadata:
labels:
app:<value>
Labels on the ReplicationController
The labels which are used in the replication controller are the key-value pairs that can be attached to the resources and can be reused for recognizing the resources. Labels play a major role in the replication controller where you can identify and organize the pods. By using labels you can also manage the scheduling of pods to the required nodes.
Pod Selector
A pod selector will select the pods based on their labels. Pod selector works on the key/value pair where the selectors can be used in various Kubernetes resources like
- Replication controller.
- Deployments.
- Deamonset.
selector:
app: nginx
multiple labels can be used in pod selector you can separate them by using commas as the following.
selector:
app: web app
tier: frontend
Kubernetes – Replication Controller
With the help of the open-source container orchestration technology Kubernetes, software deployment, scalability, and management are mostly automated. Another name for Kubernetes is K8s. Google created Kubernetes, which is now overseen by the Cloud Native Computing Foundation. Even though it now works with CRI-O as well as Docker runtime, with which it was initially intended to work. Automating operational activities for container management is Kubernetes’ primary goal. It has built-in capabilities for deploying apps and rolling out necessary application modifications. Businesses like Google, Spotify, and Capital One currently use it.