Getting pod associated with job

10/4/2016

How do I get the pod associated with a job via the Kubernetes REST API? I cannot figure out how the two are related/linked other than by similar (but not the same) generated names.

-- mark
kubernetes

1 Answer

10/4/2016

You can send a LIST request for pods, with ListOptions.LabelSelector set to the selector of the Job.

If you are not using the go client for kubernetes, you need to spell the LabelSelector as a query parameter, e.g., https://<host_address>/api/v1/namespaces/default/pods?labelSelector=component%3Dspark-master

-- caesarxuchao
Source: StackOverflow