<p>I'm a very new user of k8s python client.</p>

<p>I'm trying to find the way to get jobs with regex in python client.</p>

<p>For example in CLI,</p>

<p><code>kubectl describe jobs -n mynamespace partial-name-of-job</code></p>

<p>gives me the number of jobs whose name has <code>partial-name-of-job</code> in "mynamespace".</p>

<p>I'm trying to find the exact same code in python client.</p>

<p>I did several searches and some are suggested to use label selector, but the python client API function <code>BatchV1Api().read_namespaced_job()</code> requires the exact name of jobs.</p>

<p>Please let me know if there's a way!</p>

N Lee
<p><code>kubectl describe jobs</code> (it describes all jobs in default namespace) instead of returning the number of jobs.</p>

<p>So as mentioned by <a href="https://stackoverflow.com/a/57722892/11207414">Yasen</a> please use <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/BatchV1Api.md#list_namespaced_job" rel="nofollow noreferrer">list_namespaced_job</a> with <code>namespace</code> parameter it gives api request like <code>kubectl get --raw=/apis/batch/v1/namespaces/{namespace}/jobs</code></p>

<p>You can also modify your script and get some specific value. Please run <code>kubectl get or describe --v=8</code> to get the strict api request. 
Please refer to <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-output-verbosity-and-debugging" rel="nofollow noreferrer">Kubectl output verbosity and debugging</a></p>

<p>Hope this help</p>
