Hi, I’ve spent the last 2 days trying to run Apollo Router in a K8s cluster with no luck. I would love some help.
For some bizarre reason, it seems to work when exposing the service as a LoadBalancer, but does not work when using a NodePort service and connecting it to Ingress.
Any guidance on best practices for running with Ingress would be awesome, thanks!
I’m using GKE and the built-in load balancer for Ingress. That was a mistake. I should’ve just used Nginx ingress.
Anyway, the solution was to use a custom health check. For some reason, the default health check for the service to be labeled HEALTHY by the ingress was failing.
I followed this guide in the GCP docs. Here are the resulting K8s manifest files and router config yaml.
Apollo Router config - Exposing the GraphQL endpoint on / on port 4002 and exposing the health check endpoint /health on the same port, 4002. For Docker and K8s envs, need to use 0.0.0.0.
Deployment. Expose port 4002; make sure to specify the health check. Load router config and supergraph file from a volume mount that loads a config map.