Working With Replication Controller & Replication Set
A replication controller (RC) is a supervisor for long-running pods. An RC will launch a specified number of pods called 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.
- Lets deploy some pod with replication controller using yml file, please refer this link
kubectl create -f rc-definition.yml
- Get list of replication controller
kubectl get replicationcontroller
- Get list of Pods
kubectl get pods
A ReplicaSet’s purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods.
- Lets deploy some pod with replication controller using yml file, please refer this link
kubectl create -f rs-definition.yml
- Get list of replication controller
kubectl get replicationset
- Get list of Pods
kuberctl get pods
- You can increase the number of pods by updating the yml definition file then running:
kubectl replace -f rs-definition.yml
- You can also increase the number of pods by using scale command:
kubectl scale -replicas=6 -f rs-definition.yml
- Delete replication set using:
kubectl delete replication myapp-rs