Is there a way to restart pods automatically after some time or when they reach some memory limit?
I want achieve the same behavior as gunicorn(or any mainstream process manager does)
Memory limit
If you set a limit for the memory on a container in the podTemplate, this pod will be restarted if it uses more than specified memory.
resources:
limits:
memory: 128Mi
See Managing Compute Resources for Containers for documentation
Time limit
This can be done in many different ways, internally by calling exit(1)
or stop responding on a configured livenessProbe. Or externally, e.g. by configuring a CronJob.