You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "xiangyanw (via GitHub)" <gi...@apache.org> on 2026/09/16 06:54:10 UTC

[I] Expose terminationGracePeriodSeconds and preStop lifecycle settings in the APISIX Helm chart [apisix-helm-chart]

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: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Expose terminationGracePeriodSeconds and preStop lifecycle settings in the APISIX Helm chart [apisix-helm-chart]

Posted by "AlinsRan (via GitHub)" <gi...@apache.org>.
AlinsRan closed issue #1011: Expose terminationGracePeriodSeconds and preStop lifecycle settings in the APISIX Helm chart
URL: https://github.com/apache/apisix-helm-chart/issues/1011


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Expose terminationGracePeriodSeconds and preStop lifecycle settings in the APISIX Helm chart [apisix-helm-chart]

Posted by "xiangyanw (via GitHub)" <gi...@apache.org>.
xiangyanw commented on issue #1011:
URL: https://github.com/apache/apisix-helm-chart/issues/1011#issuecomment-5693323209

   Proposed change
   Please add configurable values for:
   ```
   terminationGracePeriodSeconds: 30 # preserve current Kubernetes default behavior
   
   lifecycle:
     preStop:
       exec:
         command:
           - /bin/sh
           - -c
           - sleep 30
   ```
   
   The defaults can preserve current behavior, while allowing production deployments with long-lived HTTP, WebSocket, or Socket.IO connections to configure a safe drain period.
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Expose terminationGracePeriodSeconds and preStop lifecycle settings in the APISIX Helm chart [apisix-helm-chart]

Posted by "AlinsRan (via GitHub)" <gi...@apache.org>.
AlinsRan commented on issue #1011:
URL: https://github.com/apache/apisix-helm-chart/issues/1011#issuecomment-5906485370

   Fixed by #1012: `terminationGracePeriodSeconds` and the `lifecycle` (preStop) hook are now configurable via values. The defaults are unchanged (grace 30s, `sleep 30`), so set the grace period higher than the preStop sleep if you need a longer drain window.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org