Bootstrap FreeKB - OpenShift - List Jobs using the oc get jobs command
OpenShift - List Jobs using the oc get jobs command

Updated:   |  OpenShift articles

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

The oc get jobs command can be used to list the jobs in the currently selected project / namespace.

TIP

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

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

oc get jobs --namespace foo

 

If there are no recent jobs, something like this should be displayed.

No resources found in foo namespace.

 

On the other hand, if there are jobs, something like this should be displayed.

NAMESPACE  NAME              COMPLETIONS   DURATION   AGE
foo        myjob-1639634460  0/1           4d21h      4d21h

 

Or you can list a single job.

oc get job/myjob-1639634460 --namespace foo

 

Or the -A or --all-namespaces flag can be used to list the jobs in all namespaces.

oc get jobs --all-namespaces

 

The -o yaml or -o json option can be used to display more details.

oc get job/myjob-1639634460 -o yaml --namespace foo

 

Which should display something that begins like this.

apiVersion: batch/v1
kind: Job
metadata:
  creationTimestamp: "2021-12-16T06:01:02Z"
  labels:
    controller-uid: 0080d889-c22a-4194-925b-4e5fda19ba91
    job-name: myjob-1639634460
    name: myjob

 




Did you find this article helpful?

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



Comments


Add a Comment


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