<p>I have been struggling for some time to figure out how to accomplish the following:
I want to delete running pod on Azure Kubernetes Service cluster on scheduled basis, so that it respawns from deployment. This is required that application re-reads configuration files stored on shared storage and shared with other application.</p>

<p>I have found out that Kubernetes <strong><a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#what-is-a-job" rel="nofollow noreferrer">Jobs</a></strong> might be handy to accomplish this, but there is some but.
I cant figure how can I select corresponding pod related to my deployment as it adds random string to the deployment name, i.e </p>

<pre><code>deployment-name-546fcbf44f-wckh4
</code></pre>

<p>Using selectors to get my pod doesnt succeed as there is not such operator like LIKE  </p>

<pre><code>kubectl get pods --field-selector metadata.name=deployment-name
</code></pre>

<p>No resources found</p>

vrvrvrvrvr
<p>Looking at the official docs one way of doing this would be like so:</p>

<pre><code>pods=$(kubectl get pods --selector=job-name=pi --output=jsonpath='{.items[*].metadata.name}')
echo $pods
</code></pre>

<p>you'd need to modify <code>job-name</code> to match your job name</p>

<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#running-an-example-job" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#running-an-example-job</a></p>
