Replica sets with example and commands

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

[centos@ip-172-31-22-14 ~]$ kubectl scale –replicas=1 deploy/namrata -n=namtest
deployment.apps/namrata scaled
[centos@ip-172-31-22-14 ~]$ kubectl scale –replicas=10 deploy/namrata -n=namtest
deployment.apps/namrata scaled
[centos@ip-172-31-22-14 ~]$ kubectl get deploy -n=namrata
No resources found in namrata namespace.
[centos@ip-172-31-22-14 ~]$ kubectl get deploy -n=namtest
NAME READY UP-TO-DATE AVAILABLE AGE
namrata 10/10 10 10 8m54s
namrata1 3/3 3 3 6m40s
[centos@ip-172-31-22-14 ~]$ kubectl get pods -n=namtest
NAME READY STATUS RESTARTS AGE
namrata 1/1 Running 0 116m
namrata-dfb987696-798c7 1/1 Running 0 2m5s
namrata-dfb987696-8b6kz 1/1 Running 0 2m5s
namrata-dfb987696-bzxsx 1/1 Running 0 2m5s
namrata-dfb987696-d9qsq 1/1 Running 0 2m5s
namrata-dfb987696-gdmwn 1/1 Running 0 2m5s
namrata-dfb987696-gwgfr 1/1 Running 0 2m5s
namrata-dfb987696-lxf69 1/1 Running 0 10m
namrata-dfb987696-qtt8c 1/1 Running 0 2m5s
namrata-dfb987696-tvz9j 1/1 Running 0 2m5s
namrata-dfb987696-xn7wc 1/1 Running 0 2m5s
namrata1-b5dc88477-7f9q9 1/1 Running 0 8m22s
namrata1-b5dc88477-9jhk7 1/1 Running 0 8m22s
namrata1-b5dc88477-lm2r4 1/1 Running 0 8m22s
[centos@ip-172-31-22-14 ~]$ kubectl get rs -n=namtest
NAME DESIRED CURRENT READY AGE
namrata-dfb987696 10 10 10 10m
namrata1-b5dc88477 3 3 3 8m31s
[centos@ip-172-31-22-14 ~]$ kubectl describe po
Name: nagesh
Namespace: default
Priority: 0
Node: ip-172-31-26-110.ap-south-1.compute.internal/172.31.26.110
Start Time: Thu, 16 Sep 2021 04:50:59 +0000
Labels: app=helloworld
Annotations:
Status: Running
IP: 10.44.0.4
IPs:
IP: 10.44.0.4
Containers:
nagesh:
Container ID: docker://79ba529d343accf9ee69a1b1a08ca9ae6b7f8e87d338f99c06ef17cb020a6b9d
Image: scmgalaxy/nginx-devopsschoolv1
Image ID: docker-pullable://scmgalaxy/nginx-devopsschoolv1@sha256:0544f1e7eb70ee9967819f1655160f5457d47aa24910a32f357c1a41aab3d20b
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Thu, 16 Sep 2021 04:51:02 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-plrl6 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-plrl6:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
[centos@ip-172-31-22-14 ~]$ kubectl describe pod namrata-dfb987696-798c7 -n=namtest
Name: namrata-dfb987696-798c7
Namespace: namtest
Priority: 0
Node: ip-172-31-26-110.ap-south-1.compute.internal/172.31.26.110
Start Time: Thu, 16 Sep 2021 06:48:50 +0000
Labels: app=namrata
pod-template-hash=dfb987696
Annotations:
Status: Running
IP: 10.44.0.18
IPs:
IP: 10.44.0.18
Controlled By: ReplicaSet/namrata-dfb987696
Containers:
nginx-devopsschoolv1:
Container ID: docker://72e72132785d747742c832107d43ca13ec0235dab8de2e4390766ed18f6e6ebb
Image: scmgalaxy/nginx-devopsschoolv1
Image ID: docker-pullable://scmgalaxy/nginx-devopsschoolv1@sha256:0544f1e7eb70ee9967819f1655160f5457d47aa24910a32f357c1a41aab3d20b
Port:
Host Port:
State: Running
Started: Thu, 16 Sep 2021 06:49:03 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qvnfz (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-qvnfz:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
—- —— —- —- ——-
Normal Scheduled 3m default-scheduler Successfully assigned namtest/namrata-dfb987696-798c7 to ip-172-31-26-110.ap-south-1.compute.internal
Normal Pulling 2m58s kubelet Pulling image “scmgalaxy/nginx-devopsschoolv1”
Normal Pulled 2m48s kubelet Successfully pulled image “scmgalaxy/nginx-devopsschoolv1” in 10.495392305s
Normal Created 2m48s kubelet Created container nginx-devopsschoolv1
Normal Started 2m47s kubelet Started container nginx-devopsschoolv1