In this blog, we will show you the steps to edit and delete the replication controller in the Kubernetes environment.
- 2 Node Cluster ( 1 Master VM with 2 Nodes)
- Kubernetes Components
- We have already installed and configured the 2 Node cluster in our demo environment.
- Please check the URL https://www.assistanz.com/steps-to-install-kubernetes-cluster-manually-using-centos-7/ for more information.
REPLICATION CONTROLLER OVERVIEW
- We have already created a replication controller in our environment.
- Currently, there are four PODs available in this replication controller. It created pods on both nodes randomly.
EDITING REPLICATION CONTROLLER
- Use the below command to edit the replication controller.
Syntax: kubectl edit rc <replication controller name>
Example: kubectl edit rc rep-pod
- It opens in the default text editor.
- We are editing the total number of replicas from 4 to 6.
- Save and close the file.
- After few minutes, we can see two new pods are in running status.
- We can also scale down the PODS by editing the replication controller.
- Now we can see the excess POD’s are terminating.
DELETING THE REPLICATION CONTROLLER
- Use the below command to delete a replication controller.
Syntax: kubectl delete rc <replication controller name>
Example: kubectl delete rc rep-pod
- Replication controller deleted successfully.
- Also, there are no pods are available related to the replication controller.
DELETING REPLICATION CONTROLLER WITHOUT DELETING THE PODS
- Use the below command to delete the replication controller without deleting the pods.
Syntax: kubectl delete rc <replication controller name> --cascade=false
Example: kubectl delete rc rep-pod --cascade=false
- Command executed successfully.
- You can see the POD’s are available after deleting the replication controller.
Thanks for reading this blog. We hope it was useful for you to learn about the steps to Edit and Delete the Replication controller.