'Kubernetes: how to restart pods on memory or/and time limits?
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)
Solution 1:[1]
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.
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 |
