tencent cloud

Tencent Kubernetes Engine

文档Tencent Kubernetes EngineTroubleshootingEngel Ingres appears in Connechtin Reverside

Engel Ingres appears in Connechtin Reverside

Download
聚焦模式
字号
最后更新时间: 2024-12-13 14:48:39

Symptom

When you are using NGINX Ingress and reducing the number of NGINX Ingress Controller replicas, the problem of "Connection Refused" may occur. In this case, RSs are unbound from CLB instances in batches, and TCP/UDP listeners stop forwarding existing connections.

Possible Causes

View the source code of NGINX Ingress and you can see that the workloads of NGINX Ingress Controller have no graceful shutdown capabilities. Therefore, a Pod directly exits after receiving the kill signal.


Solutions

If you use TKE's graceful service shutdown capabilities, when a Pod needs to be deleted, it can process the received requests, and inbound traffic is turned off while outbound traffic is still on. Outbound traffic will not be turned off until all existing requests are processed and the Pod is deleted. The Pod is deleted after the graceful shutdown period ends.


Troubleshooting

Note:
This is only effective in the direct access mode. Check whether your cluster supports direct access.

Step 1

Use an annotation to indicate the use of graceful shutdown in the ****-ingress-nginx-controller Service in the kube-system namespace.
The following is an example of using an annotation to indicate the use of graceful shutdown. For more information on Service annotations, see Service Annotation.
kind: Service
apiVersion: v1
metadata:
annotations:
service.cloud.tencent.com/direct-access: "true" ## Enable CLB-to-Pod direct access
service.cloud.tencent.com/enable-grace-shutdown: "true" # Indicate the use of graceful shutdown
name: my-service
spec:
selector:
app: MyApp

Step 2

Add a sleep period before the wait-shutdown of the ****-ingress-nginx-controller Deployment in the kube-system namespace.
lifecycle:
preStop:
exec:
command:
- sleep # Add a sleep period
- 30s # Add a sleep period
- /wait-shutdown # Add a sleep period before this line
For more information, see Graceful Service Shutdown. If the problem persists, submit a ticket for assistance.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈