<p>In kubernetes, if I desired to have pods for a specific task not always required is it possible to have the system spin pods up for a given task when needed? Can this be managed through the backend code (in my instance python)? Do services need to be defined in a certain way in advance?</p>
<p>I found an api for docker management in <a href="https://docker-py.readthedocs.io/en/stable/" rel="nofollow noreferrer">Python</a>, would this work for Kubernetes?</p>

EoinHanan
<p>I don't know exactly what you want to achieve because you are not giving enough information. Here are some tools you migh want to check:</p>
<p><a href="http://keda.sh" rel="nofollow noreferrer">keda</a> - event driven autoscaler, can scale down to zero</p>
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">k8s jobs</a> - runs one time jobs</p>
<p><a href="https://knative.dev/" rel="nofollow noreferrer">knative</a> - can scale down to zero</p>
<p>You can also just use k8s python client library to run a pod, make it do whatever you want and then delete it.</p>
