Bootstrap FreeKB - OpenShift - List replicas using REST API
OpenShift - List replicas using REST API

Updated:   |  OpenShift articles

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.

This assumes you have used the curl REST API to obtain an OAuth bearer token. Let's say the bearer token is sha256~0Rs__hPuXmBD3TJTXNDisC7wRBN-nrFnYTxgdBrFT-U.

Here is how you would list the replicas in the "foo" namespace using the curl REST API. The oc config view or oc get apiserver commands can be used to display the API Server URL ( in this example).

--request GET
--header "Accept: application/json"
--header "Authorization: Bearer sha256~0Rs__hPuXmBD3TJTXNDisC7wRBN-nrFnYTxgdBrFT-U"
--url ""


If the items array contains key value pairs, this means the namespace contains one or more pods. Notice in this example that the deployment has 3 replicas.

  "kind": "ReplicaSetList",
  "apiVersion": "apps/v1",
  "metadata": {
    "selfLink": "/apis/apps/v1/namespaces/foo/pods",
    "resourceVersion": "92368763"
  "items": [
      "metadata": {
        "name": "helloworld-3-2-b89cd49c8-rvg77",
        "annotations": {
          "": "3",
          "": "4",
          "": "5"
      "spec": {
        "replicas": 3,
        "selector": {
          "matchLabels": {
            "app": "helloworld"


Did you find this article helpful?

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


Add a Comment

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