Difficulty: Beginner
Estimated Time: 10-15 minutes

In this scenario, you'll learn how to use Kubectl to create Replication Controllers and ReplicaSets. We will also use ReplicaSet as an Horizontal Pod Autoscaler Target.

In this scenario, we learned to use Replication Controllers and ReplicaSets.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

ReplicaSets and ReplicaController

Step 1 of 6

Step 1 - Replication Controller

A ReplicationController ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes sure that a pod or a homogeneous set of pods is always up and available.

ReplicationController Working

If there are too many pods, the ReplicationController terminates the extra pods. If there are too few, the ReplicationController starts more pods.

Pod without ReplicationController

  • Unlike manually created pods, the pods maintained by a ReplicationController are automatically replaced if they fail, are deleted, or are terminated.
  • For example, your pods are re-created on a node after disruptive maintenance such as a kernel upgrade.
  • You should use a ReplicationController even if your application requires only a single pod.
  • A ReplicationController is similar to a process supervisor, but instead of supervising individual processes on a single node, the ReplicationController supervises multiple pods across multiple nodes.

ReplicationController is often abbreviated to “rc” or “rcs” in discussion, and as a shortcut in kubectl commands.

Usage

A simple case is to create one ReplicationController object to reliably run one instance of a Pod indefinitely. A more complex use case is to run several identical replicas of a replicated service, such as web servers.

replication.yaml
replicaset.yaml
hpa-rs.yaml