OpenShift - List replicas using the oc get replicaset command

An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

Replicas is the number of pods that should be created for the deployment.

The oc get deployments command can be used to view the applications that have been deployed in the currently selected project / namespace.

~]# oc get deployments
NAME                 DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
my-app-5b9879db6d    1         1         1            1           205d

 

The oc get replicaset (or oc get rs) command can be used to list the replica sets in a project / namespace. In this example, the deployment has 1 replica which means that 1 pod should be created for the deployment.

TIP

The -A or --all-namespaces flag can be used to list the replica sets in every project / namespace.

The -n or --namespace flag can be used to list the replica sets in a certain project / namespace.

~]# oc get replicaset 
NAME                      DESIRED   CURRENT   READY   AGE
my-app-5b9879db6d         1         1         1       205d

 

Or the oc get deployments command with the jsonpath option can also be used to see the number of pods that should be created for the deployment.

~]# oc get deployment my-app-5b9879db6d --output jsonpath={.spec.replicas}
1

 

oc get pods command can be used to display the pods. In this example, as expected, one pod was created for the deployment.

~]# oc get pods
NAME                       READY   STATUS     RESTARTS  AGE
my-app-5b9879db6d-9mzm2    1/1     Running    0         8d

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 02aa2 in the box below so that we can be sure you are a human.