AI Briefing
KO

Core of Kubernetes Zero-Downtime Deployment from Kakao DKOS Operations Team: Graceful Shutdown and Option Configuration

·2018.12.24 00:00

Key point

Based on Kakao DKOS operational experience, this article introduces how to implement Graceful Shutdown and configure key options such as maxSurge, readinessProbe, and preStop Hook to prevent traffic loss (502 errors) during Kubernetes deployments.

1 / 8

Details

Kubernetes is the standard for container orchestration. To maintain service continuity without traffic loss during deployments, both cluster-level option configuration and Graceful Shutdown implementation within containers are crucial.

  1. Graceful Shutdown: When terminating a Pod, Kubernetes sends a SIGTERM signal via kubelet. Applications inside the container must receive this signal, complete ongoing requests, and then shut down. If this is not implemented and the application terminates immediately, according to the original text, 502 errors may occur in approximately 17.44% of requests. The default wait time is set by terminationGracePeriodSeconds (default 30 seconds), and if exceeded, the process is forcibly terminated with SIGKILL.

  2. Kubernetes Deployment Options:

    • maxSurge & maxUnavailable: Adjust the number of additional Pods allowed during rolling updates (maxSurge) and the number of unavailable Pods permitted (maxUnavailable) to ensure that a certain number of Pods always handle traffic. Both values cannot be set to 0.
    • readinessProbe: This is a health check that verifies whether a Pod is actually ready to serve. For applications with long initialization times, such as Java, livenessProbe alone is insufficient; the IP address is registered with the Service and traffic is accepted only when readinessProbe is in the OK state. If configuration is difficult, .spec.minReadySeconds can be used to secure a minimum wait time, but this time is ignored once readinessProbe completes.
    • preStop Hook: For legacy systems where modifying the application is difficult, a preStop Hook that executes just before sending SIGTERM can be used to secure wait time and mimic the effects of Graceful Shutdown. However, care must be taken not to exceed terminationGracePeriodSeconds.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.