In this blog, we will show you the Steps to create Replica sets 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://blog.assistanz.com/steps-to-install-kubernetes-cluster-manually-using-centos-7/ for more information.
- Currently, there are four orphan PODS which was created using the replication controller.
- All the POD’s are labeled with app=web env=test.
- We will show you how to add the orphan pods into a Replica Set.
REPLICA SET BENEFITS
CREATING A NEW REPLICA SET
- From the master node, open the default text editor.
- Add the below script in the YML file.
– name: rs-pod
- Save and close the file.
- Use the below command to create a new replica set.
kubectl apply -f rs.yml
- A new replica set is created successfully.
VERIFYING THE REPLICA SET
- Use the below command to view the list of replica set available in your environment.
kubectl get rs
- It added the orphan pods into the replica set. Also, it has not created any additional pods for the replica set.
- We can also describe the replica set using the below command.
Syntax: kubectl describe rs <replica set name>
Example: kubectl describe rs rs-web
- There are more expressions available for the replica set and will share that information in future blogs.
Thanks for reading this blog. We hope it was useful for you to learn to about the steps to create Replica sets in the Kubernetes.