#502s when serving project build with `standalone` through Nginx Ingress on K8S

3 messages · Page 1 of 1 (latest)

remote kernel
#

I have built an application, which is served locally without issue through next start. However, when I build my application, in standalone mode, and try to deploy it in a local K8S cluster, building an image as per the docs (https://nextjs.org/docs/pages/building-your-application/deploying#docker-image). Once I try to serve it through a basic service, and an Nginx Ingress Controller I get hit with 502s on seemingly random requests (happens on roughly 1/8 requests).

I have set Nginx's nginx.ingress.kubernetes.io/proxy-buffer-size to 256kb (also 1Mb later on), and proxy_buffers to 8 256kb afterwards to try and fix the issue. None of these seem to have any effect.

Since this happens to "random" requests getting JS files, enabling caching on the browser "solves" it by caching the bundle files. Nginx logs don't show any errors, and the pods themselves never went down, nor has CPU usage/memory usage spiked in peculiar manners.

Is this a known issue, or are there quirks to K8S deployments behind reverse proxies that I need to watch out for?

Learn how to deploy your Next.js app to production, either managed or self-hosted.

kindred finchBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

remote kernel
#

It was caused by duplicate selector labels in the deployments