我在使用 nginx-lego(我知道它已被弃用)和节点自动缩放器时遇到问题。我不得不通过 HPA 手动扩展并临时修补 minReplicas 到一个高数字。一切都很好地扩展,由于 pod 的增加而添加了新节点。
流量高峰后,我将数字设置回正常(非常低),我可以看到很多错误的网关 502 错误。在我检查了 nginx-lego pod 的日志后,我能够看到大量请求发送到不再存在的 pod(连接被拒绝或没有路由到主机)。
2018/11/21 17:48:49 [error] 5546#5546: *6908265 connect() failed (113: No route to host) while connecting to upstream, client: 100.112.130.0, server: xxxx.com, request: "GET /public/images/social-instagram.png HTTP/1.1", upstream: "http://X.X.X.X:3000/public/images/social-instagram.png", host: "xxxx.com", referrer: "https://outlook.live.com/"
2018/11/21 17:48:49 [error] 5409#5409: *6908419 connect() failed (113: No route to host) while connecting to upstream, client: 10.5.143.204, server: xxxx.com, request: "GET /public/images/social-instagram.png HTTP/1.1", upstream: "http://X.X.X.X:3000/public/images/social-instagram.png", host: "xxxx.com"
2018/11/21 17:48:49 [error] 5546#5546: *6908420 connect() failed (111: Connection refused) while connecting to upstream, client: 10.5.143.204, server: xxxx.com, request: "GET /public/images/social-facebook.png HTTP/1.1", upstream: "http://X.X.X.X:3000/public/images/social-facebook.png", host: "xxxx.com"
知道什么可能是错的吗?
我想修补 minReplicas 可能不是最好的方法,但我知道会有一个峰值,而且我对如何预扩展整个集群没有更好的想法。