Kubernetes replicasets

Kubernetes has a feature of deploying multiple replicas of a pod and managing them from workstation. Each of these sets of replicas of a pod are called replicasets.

Replicasets can be created, deleted, updated in a single time. These are shown as deployments in the kubectl cli

Creating deployment:

kubectl create deployment rajesh –image=scmgalaxy/nginx-devopsschoolv1 –replicas=3 -n=sumit

Getting list of replicas deployed in namespace:

kubectl get deploy -n=sumit

Scale deployment:

kubectl scale –replicas=3 deploy/rajesh -n=sumit

O/p:
deployment.apps/rajesh scaled
[centos@ip-172-31-22-14 ~]$ kubectl get deploy -n=sumit
NAME READY UP-TO-DATE AVAILABLE AGE
rajesh 3/3 3 3 4m43s

Delete deployment:

kubectl delete deploy rajesh -n=sumit
deployment.apps “rajesh” deleted