n8n: automation without code
The first Grafana alert landed in Telegram with no email configured and no dashboard open — just a message arriving in the right place. That kind of automation, connecting two services that were never meant to talk to each other directly, is what n8n makes trivial in the homelab.
n8n is an open-source workflow automation tool, similar to Zapier or Make, but self-hostable. It connects services together through a visual interface — trigger an action when an event occurs, transform data, send notifications.
In the homelab, n8n orchestrates tasks that would otherwise be scattered cron scripts:
- Telegram notifications on a Grafana alert
- Automatic configuration backups to Gitea
- Weekly cluster status report
- Webhooks between internal services
Deployment
This deployment uses PostgreSQL as its database and Redis for the execution queue, in queue mode: 1 main process (n8n-main) + 2 workers. This setup lets the workers process executions in parallel without blocking the interface.
# n8n-main Deployment
containers:
- name: n8n
image: n8nio/n8n:1.123.37
env:
- name: EXECUTIONS_MODE
value: queue
- name: QUEUE_BULL_REDIS_HOST
value: redis.n8n.svc.cluster.local
- name: DB_TYPE
value: postgresdb
- name: DB_POSTGRESDB_HOST
value: postgres.n8n.svc.cluster.local
- name: DB_POSTGRESDB_DATABASE
value: n8n
- name: DB_POSTGRESDB_USER
value: n8n
- name: DB_POSTGRESDB_PASSWORD
valueFrom:
secretKeyRef:
name: n8n-credentials
key: DB_PASSWORD
- name: N8N_ENCRYPTION_KEY
valueFrom:
secretKeyRef:
name: n8n-credentials
key: N8N_ENCRYPTION_KEY
- name: WEBHOOK_URL
value: https://n8n.olig-homelab-2025.win/
volumeMounts:
- name: data
mountPath: /home/node/.n8n
Queue mode: EXECUTIONS_MODE=queue + Redis decouples the interface from workflow execution. The workers (separate pods) consume the Redis queue independently of the main process.
EXECUTIONS_MODE=queue : n8n-main dépose, les workers consomment en parallèle —
un workflow lourd n'a plus aucun impact sur l'interface. Les workers se scalent horizontalement,
n8n-main reste en strategy: Recreate (instance unique).
WEBHOOK_URL must point to the service’s public URL — n8n uses it to build the URLs of the webhooks exposed to external services.
Typical workflows
Grafana alerting → Telegram: Grafana sends a webhook alert to n8n. n8n formats the message and sends it through the Telegram bot. More readable than Grafana’s raw email notifications.
Daily health check: a scheduled workflow (Cron node) queries node status through the Kubernetes API, formats a report in markdown, and sends a Telegram message every morning.
Automatic mirroring (pre-migration architecture, see the update in Self-Hosted Git Forge with Gitea): this workflow triggered a Gitea mirror synchronisation as soon as a GitHub repository was updated. It belongs to the old architecture, where GitHub was still the source of truth.
Lessons learned
Queue mode vs single: queue mode (PostgreSQL + Redis + separate workers) is the recommended setup as soon as you want reliable parallel executions. In single mode, one heavy workflow blocks the interface. In queue mode, the workers process executions in the background.
strategy: Recreate on the main process: n8n-main must have only one active instance to avoid conflicts. The workers can be scaled horizontally without restriction.
Export the workflows: n8n can export workflows as JSON. Versioning those exports in Git provides a backup and makes it possible to rebuild the automations after a reinstall.
Secrets inside n8n: the credentials (API tokens, passwords) configured in n8n are stored encrypted in PostgreSQL. N8N_ENCRYPTION_KEY must remain stable — changing it invalidates every stored credential. Store it in a SealedSecret and never regenerate it.