0

I'm starting using Kubernetes/Docker and would like to know how to configure it for sleep some pod (container) after 30 minutes of inactivity.

My team will working with a lot of pod and some of them will have to sleep after some time without user access.

Heroku free Dyno have as well this feature.

So, how to configure Kubernetes or Docker to be able do this feature? Anyone can help?

Bruce
  • 101
  • 1
  • You can have haproxy installed and use haproxy stats to monitor the activities of pod – bej Jul 27 '17 at 05:58
  • Answer on [this thread](https://stackoverflow.com/questions/34276570/kubernetes-pod-with-sleep-command-hangs?noredirect=1&lq=1) might be useful. – Faizan Aug 04 '17 at 17:12
  • @Faizan that thread is about running the `sleep` command in a pod, not putting a pod to sleep –  Feb 13 '18 at 15:23

1 Answers1

0

Kubernetes supports pod autoscaling based on CPU usage. Something like:

kubectl autoscale deployment/my-deployment --min=1 --max=15 --cpu-percent=80

Check the full documentation here: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/ It also provides examples for metrics other than CPU usage.

Marco Luglio
  • 101
  • 3