'Kubernetes deployment

I have deployed a pod in kubernetes cluster that run a python script.

The problem is i want to force the k8s to stop the container after the script complete his job and not to re-create another pod.

To be aware that i have tried to use kind:job but it doesn't fulfill my need.

I tried two types of kind, job and deployments.

With the deployment the pod always show status first completed after that crush with crashloopbackof error.

With the job the pod always show the status completed but i don't have the possibility to re-excute it with an automated way

Do you have any suggestions about that?



Solution 1:[1]

I have posted community wiki answer to summarise the topic.

User Jonas has posted great suggestions:

A kind Job does exactly this. Use Job and your problem is solved.

If you deploy with kubectl create -f job.yaml and your job has a generateName: instead of name:, a new Job will be created each time.

For more information look at the documentation about Jobs. See also information about Gnerated values.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1