Monitoring the progress of specified pods with oc cli

915 Views Asked by At

I want to know is there a way to monitor the progress of a particular pod instead of seeing all pods?

For example I scale consleapp

oc scale dc consleapp --replicas=3

After that command I want to watch the progress of only consoleapp and ensure the pods are active. I thought you'd be able to run this command oc get pods consoleapp -watch but it does not work. Is there a way for me to monitor the progress of this? very similar to oc rollout status deploymentconfig/consoleapp --watch but without rolling out a new deployment.

1

There are 1 best solutions below

0
larsks On

When you run oc get pods consoleapp, you're asking for a pod named consoleapp, which of course doesn't exist. If you want to watch all the pods managed by the DeploymentConfig, you can use the --selector (-l) option to select pods that match the selector in your DeploymentConfig.

If you have:

spec:
  selector:
    name: consoleapp

Then you would run:

oc get pod -l name=consoleapp -w

If your selector has multiple labels, combine them with commas:

oc get pod -l app=consoleapp,component=frontend -w

NB: DeploymentConfigs are considered deprecated and can generally be replaced by standard Kubernetes Deployments:

Both Kubernetes Deployment objects and OpenShift Container Platform-provided DeploymentConfig objects are supported in OpenShift Container Platform; however, it is recommended to use Deployment objects unless you need a specific feature or behavior provided by DeploymentConfig objects.

(from "Understanding Deployment and DeploymentConfig objects")