Deploy n8n on Kubernetes: Production-Ready Automation Stack

Deploy n8n in a production-ready, non-queue setup with dedicated backend services to handle automated workflows on your cluster. This template configures the core application, a persistent PostgreSQL instance, and an ephemeral Redis instance, fulfilling search requirements for users looking to deploy n8n on Kubernetes, find an n8n Kubernetes template, or configure an n8n Kubernetes deployment.
| Component | Type | Port | Role |
|---|---|---|---|
| Namespace | Namespace | None | Sets up isolated environment for the stack |
| n8n-pg-pvc | PVC | None | Reserves 10 GB of disk space for PostgreSQL |
| n8n-pg-config | ConfigMap | None | Stores non-sensitive database environment variables |
| n8n-pg-secret | Secret | None | Secures the administrator password for PostgreSQL |
| n8n-redis-config | ConfigMap | None | Stores network connection strings for Redis |
| n8n-app-config | ConfigMap | None | Stores app variables including database and webhook URLs |
| n8n-app-secret | Secret | None | Enforces security for the N8N_ENCRYPTION_KEY string |
| postgres | StatefulSet | 5432 | Deploys a stable postgres:16 instance for storage |
| postgres-service | Service | 5432 | Exposes the PostgreSQL database internally to n8n |
| redis | Deployment | 6379 | Runs an ephemeral redis:7-alpine container for cache |
| redis-service | Service | 6379 | Provides internal network access to the Redis instance |
| n8n | Deployment | 5678 | Runs the main n8n container with init checks |
| n8n-service | Service | 5678 | Routes cluster-internal traffic to the n8n workload |
| IngressClass | IngressClass | None | Defines the global cluster-scoped NGINX controller |
| n8n-ingress | Ingress | 5678 | Exposes n8n externally over HTTP via n8n.local |
| n8n-hpa | HPA | None | Monitors resources and locks the process to 1 replica |
| n8n-quota | ResourceQuota | None | Caps computing resource consumption for the namespace |
| n8n-limits | LimitRange | None | Declares container-level request and limit boundaries |
| postgres-netpol | NetworkPolicy | 5432 | Restricts PostgreSQL traffic to n8n pods only |
| redis-netpol | NetworkPolicy | 6379 | Restricts Redis traffic to n8n pods only |
| n8n-netpol | NetworkPolicy | 5678 | Isolates n8n to allow traffic only from ingress-nginx |
The Ingress resource routes external traffic through the local hostname to the n8n Service. The n8n Deployment utilizes twin init containers to poll network readiness on the internal PostgreSQL and Redis services before booting the primary application process. The single-replica limitation prevents scheduling conflicts, while the PostgreSQL database utilizes stable stateful pod identities alongside persistent disk volumes to preserve operational workflow data across pod recycles. Network policies isolate the entire database and caching layers, permitting traffic strictly from verified application workloads.
N8N_ENCRYPTION_KEY inside the n8n-app-secret file to ensure database credential safety.WEBHOOK_URL entry within the n8n-app-config map to map precisely with your targeted external domain name.kubectl get pods -n n8n to verify that the PostgreSQL init containers completed and the main n8n instance is running.http://n8n.local to load the initial setup and login dashboard.This template provisions a non-queue, production-grade n8n automation stack backed by a persistent PostgreSQL StatefulSet and a volatile Redis caching layer.