×
Create a Replication Controller using the kubectl command
Blog Cloud Computing Containers

Steps to create a Replication Controller using the kubectl command

Steps to create a Replication Controller using the kubectl command

In this blog, we will show the Steps to create a Replication Controller using the kubectl command in the kubernetes environment.

REQUIREMENTS

  • 2 Node Cluster ( 1 Master VM with 2 Nodes)
  • Kubernetes Components

 

INFRASTRUCTURE OVERVIEW

  • We have already installed and configured the 2 Node cluster in our demo environment.

 

CREATING REPLICATION CONTROLLER USING KUBECTL

  • Login to the Master node through putty.

Steps to create a Replication Controller using the kubectl command

 

  • use the below command, to create replication controller POD.

Syntax: kubectl run <name for the replication controller> --image=<image name> --generator=run/v1

Example: kubectl run web-rc --image=nginx --port=80 --generator=run/v1

Steps to create a Replication Controller using the kubectl command

 

  • In few seconds, replication controller created successfully.

Steps to create a Replication Controller using the kubectl command

 

  • You can verify the replication controller through describe command.

kubectl describe replicationcontroller web-rc

Steps to create a Replication Controller using the kubectl command

 

 

SCALING UP THE POD REPLICAS

  • By default, it will create only one POD if we do not specify the replica set numbers. You can verify it by listing the pods.

kubectl get pods

Steps to create a Replication Controller using the kubectl command

 

  • Use the below command to increase the replica set.

Syntax: kubectl scale <resource type> <replication controller name> --replicas=<number of required replicas>

Example: kubectl scale replicationcontroller web-rc --replicas=3

Steps to create a Replication Controller using the kubectl command

 

  • The command executed successfully.

Steps to create a Replication Controller using the kubectl command

 

  • We can able to see two more pods are in starting status.

Steps to create a Replication Controller using the kubectl command

 

  • We can find the pods events through describe command.

kubectl describe pods web-rc-t5w6z

Steps to create a Replication Controller using the kubectl command

 

Steps to create a Replication Controller using the kubectl command

 

  • After few seconds, all the pods will be in running status.

Steps to create a Replication Controller using the kubectl command

 

SCALING DOWN THE POD REPLICAS

  • We can use the same kubectl scale command with less replica set.

kubectl scale replicationcontroller web-rc --replicas=1

Steps to create a Replication Controller using the kubectl command

 

  • It will scale down to one POD.

Steps to create a Replication Controller using the kubectl command

 

  • You can see the PODS are terminating using kubectl get pods command.

Steps to create a Replication Controller using the kubectl command

 

  • After few seconds, you can have only one POD in the replica set.

Steps to create a Replication Controller using the kubectl command

 

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn about creating replication set using the kubectl command.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.