I have deployed a java application (backend) in openshift, and i have spun up 3 pods backend-1-abc, backend-1-xyz and backend-1-def.
How can I get the list of all the pod names for this service "backend"? Is it possible to obtain it programatically or is there any endpoint exposed in openshift to obtain this?
Are you saying you have actually created three separate Pod definitions with those names? Are you not using a DeploymentConfig or StatefulSet?
If you were using StatefulSet the names would be predictable.
Either way, the Pods would usually be set up with labels and could use a command like:
oc get pods --selector app=myappname
Perhaps have a read of:
It touches on labelling and querying based on labels.
Please provide more details about how you are creating the deployment if want more details/options.