Is terminationGracePeriodSeconds enough for liveki...
# ask-ai
w
Is terminationGracePeriodSeconds enough for livekit egress using kubernetes? I want to avoid loosing recordings
t
Thanks for reaching out, Alberto. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You’re asking whether
terminationGracePeriodSeconds
alone is enough to avoid losing LiveKit Egress recordings during a Kubernetes shutdown. Short answer: no — it’s necessary but not sufficient. What to do • Keep a generous
terminationGracePeriodSeconds
value that covers your longest expected recording duration. • Rely on LiveKit Egress’s graceful-shutdown behavior: on
SIGTERM
it stops accepting new jobs and lets in-progress jobs finish. This plus a long enough grace period lets recordings complete. • Ensure autoscaling/availability logic (Prometheus metric
livekit_egress_available
in LiveKit Cloud or your own monitoring) won’t scale down or terminate pods that are handling active recordings. If you’d like, tell me: 1. Typical/max recording length you expect, and 2. Whether you use autoscaling or a managed LiveKit Cloud setup — so I can suggest a concrete
terminationGracePeriodSeconds
value and additional safeguards. Sources: Deploy to Kubernetes | LiveKit docs | Self-hosting the Egress Service | LiveKit docs | Distributed Setup | LiveKit docs | Quotas and limits | LiveKit docs
w
what value do you recommend?
t
Thanks — to recommend a safe
terminationGracePeriodSeconds
value I need one quick detail: What’s the typical or maximum length of a single recording/egress job you expect (minutes or hours)? Also tell me if you use horizontal autoscaling (HPA/KEDA) that might scale pods down automatically.
w
up to 8 hours
t
Thanks — since your longest recordings can be up to 8 hours, I recommend the following. • Set terminationGracePeriodSeconds to at least 28,800 (8 hours). • Add a safety buffer to account for wrap-up and upload time — e.g., 32,400 (9 hours). Also ensure: • LiveKit Egress’s graceful-shutdown is enabled so pods stop accepting new jobs on SIGTERM and let in‑progress jobs finish. • Any autoscaler (HPA/KEDA) respects active egress work (use the
livekit_egress_available
metric or a custom check) so pods with active recordings are not scaled down. Would you like suggested Kubernetes YAML snippets for the recommended values or help verifying your autoscaler ties to active egress metrics?