A replication controller (RC) is a supervisor for
long-running pods. An RC will launch a specified number of pods called
<< Previous Next >>
replicas
and makes sure that they keep running, for example when
a node fails or something inside of a pod, that is, in one of its containers
goes wrong.
It is one of the Kubernetes controllers used to make
sure that we have a specified number of pod replicas running (A controller in Kubernetes is
what takes care of tasks to make sure the desired state of the cluster matches
the observed state). Without it, we will have to create multiple
manifests for the number of pods we need which is a lot of work to deploy
replicas of a single application. In previous versions of Kubernetes, it was
called “Replication Controller”.
The main difference between the two is that ReplicaSets allow us to use
something called “Label
Selector”.
Lab:
You can see the RC and the pod it looks after like so:
kubectl get rc
kubectl get pods --show-labels
Note
two things here:
- the supervised pod got a random name assigned
(rcex-qrv8j)
- the way the RC keeps track of its pods is via
the label, here app=sise
To scale up, that is, to increase the number of
replicas, do:
kubectl scale --replicas=3 rc/rcex
kubectl get pods -l app=sise
To delete the rc
kubectl
delete rc rcex
<< Previous Next >>
No comments:
Post a Comment