I’m trying to set up n8n on a GKE cluster using its Helm chart. I’m having trouble with the ingress. The app keeps losing the session when I access it through the ingress. It works fine when I connect to the pod directly.
I want to add session affinity to the ingress but I’m not sure how to do it with Terraform. I’ve also thought about using an Nginx ingress but I’m new to that.
Here’s a simplified version of my Terraform config:
I’ve dealt with similar issues when deploying n8n on GKE. In my experience, using an Nginx ingress controller can provide more flexibility and better session management. Here’s what worked for me:
Install the Nginx ingress controller using Helm.
Configure your ingress resource to use the Nginx class.
Add annotations for session affinity and timeouts.
Here’s a rough example of how your ingress resource might look:
This approach has been more reliable for me than trying to manage sessions at the GKE ingress level. It also gives you more control over other aspects of your ingress configuration.
I’ve encountered similar challenges with n8n deployments on GKE. One approach that’s worked well for me is using a Google Cloud Load Balancer (GCLB) instead of a standard Kubernetes Ingress. GCLB provides built-in session affinity and can be managed through Terraform.
Here’s a simplified example of how you might set this up:
This setup should provide better session management for your n8n deployment. Remember to adjust the node pool and other specifics to match your GKE cluster configuration.