Replication Controller

This is the old technology used in kubernetes that is replaced with Replica Set. It is used to make sure that specified number of pods are running for an application. If any pods get terminated because of some reason, replication controller restarts them.

The resource yml file for replication controller is as follows.

apiVersion: v1
kind: ReplicationController
metadata:
  name: myapp-rc
  labels:
    type: frontend-rc
    name: myapp
    
spec:
  template:
    metadata:
      name: nginx
      labels:
        type: router
        name: nginx-router
    spec:
      containers:
        - name: nginx
          image: nginx
  replicas: 2

template contains the pod specifications. replicas specifies the number of replications of the pod.