xiangyanw opened a new issue, #1011:
URL: https://github.com/apache/apisix-helm-chart/issues/1011

   The APISIX Helm chart hardcodes this lifecycle hook in the Deployment:
   
   ```yaml
   lifecycle:
     preStop:
       exec:
         command:
           - /bin/sh
           - -c
           - sleep 30
   ```
   
   However, the chart does not expose 
spec.template.spec.terminationGracePeriodSeconds.
   
   Kubernetes starts the termination grace-period timer before executing 
preStop. When the Pod uses Kubernetes' default terminationGracePeriodSeconds: 
30, the hardcoded sleep 30 consumes the entire grace period. APISIX then 
receives SIGTERM with effectively no time left to complete its Nginx graceful 
shutdown.
   
   This conflicts with the APISIX worker_shutdown_timeout setting. For example, 
the chart can render:
   ```yaml
   apisix:
     nginx:
       workerShutdownTimeout: 300s
   ```
   but the Pod may still be force-killed around 30 seconds after termination 
starts.
   
   This is especially problematic behind an ALB/NLB target group with a 
300-second deregistration delay. Existing in-flight requests or long-lived 
connections can be terminated before load balancer draining completes, 
resulting in client-side errors.
   
   Environment
   - APISIX Helm chart: 2.17.0
   - APISIX image: 3.18.0-ubuntu
   - Kubernetes deployment mode
   - Target group deregistration delay: 300s
   
   Expected behavior
   The chart should expose Pod termination settings through values, so users 
can align:
   1. load balancer deregistration delay;
   2. preStop delay;
   3. APISIX/Nginx worker_shutdown_timeout;
   4. Kubernetes terminationGracePeriodSeconds.
   
   For example:
   ```
   terminationGracePeriodSeconds: 360
   
   lifecycle:
     preStop:
       exec:
         command:
           - /bin/sh
           - -c
           - sleep 30
   
   apisix:
     nginx:
       workerShutdownTimeout: 300s
   ```
   
   A grace period of 360 seconds provides:
   - 30 seconds for endpoint/LB deregistration propagation;
   - up to 300 seconds for APISIX worker draining;
   - 30 seconds of kubelet buffer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to