Skip to content

Commit b958325

Browse files
committed
feat: improve deployment modes and persistence validation
- Add validation for Deployment with PVC and multiple replicas - Add validation for webhook component with PVC - Update documentation with detailed deployment modes - Document persistence limitations for all components - Add examples for different deployment scenarios
1 parent 1022e52 commit b958325

5 files changed

Lines changed: 115 additions & 2 deletions

File tree

README.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/n8n)](https://artifacthub.io/packages/helm/open-8gears/n8n)
22

33
> [!NOTE]
4-
> The n8n Helm chart is growing in pooularity.
4+
> The n8n Helm chart is growing in popularity.
55
> We're looking for additional passionate maintainers and contributors
66
> to improve and maintain this chart, governance, development, documentation and CI/CD workflows.
77
> If you're interested in making a difference,
@@ -361,6 +361,98 @@ main:
361361
tolerations: []
362362
affinity: {}
363363

364+
## Deployment Modes
365+
366+
### Main Component
367+
368+
The main n8n component can be deployed in two modes:
369+
370+
1. **Deployment (default)**:
371+
- Suitable for Community Edition
372+
- Limited to 1 replica when using persistent storage (PVC)
373+
- Can use multiple replicas only with `emptyDir` storage (data will be lost on pod restart)
374+
375+
```yaml
376+
main:
377+
replicaCount: 1 # Must be 1 with persistent storage
378+
statefulSet:
379+
enabled: false
380+
persistence:
381+
enabled: true
382+
type: dynamic
383+
size: 10Gi
384+
```
385+
386+
2. **StatefulSet**:
387+
- Required for multiple replicas with persistent storage
388+
- Requires n8n Enterprise license
389+
- Each pod gets its own persistent volume
390+
391+
```yaml
392+
main:
393+
replicaCount: 3 # Can be >1 with StatefulSet
394+
statefulSet:
395+
enabled: true
396+
persistence:
397+
enabled: true
398+
type: dynamic
399+
size: 10Gi
400+
extraEnv:
401+
N8N_MULTI_MAIN_SETUP_ENABLED:
402+
value: "true" # Required for multiple replicas
403+
```
404+
405+
### Worker Component
406+
407+
The worker component can be deployed either as Deployment or StatefulSet:
408+
409+
```yaml
410+
worker:
411+
enabled: true
412+
count: 2
413+
statefulSet:
414+
enabled: true # or false for Deployment
415+
persistence:
416+
enabled: true
417+
size: 5Gi
418+
```
419+
420+
### Webhook Component
421+
422+
The webhook component is deployed as a Deployment and has the same limitations as the main component when using persistent storage:
423+
424+
1. **With Persistent Storage**:
425+
- Limited to 1 replica when using PVC
426+
- Data is preserved between pod restarts
427+
428+
```yaml
429+
webhook:
430+
enabled: true
431+
replicaCount: 1 # Must be 1 with persistent storage
432+
persistence:
433+
enabled: true
434+
type: dynamic
435+
size: 5Gi
436+
```
437+
438+
2. **Without Persistent Storage or with emptyDir**:
439+
- Can use multiple replicas
440+
- Data is lost on pod restarts
441+
442+
```yaml
443+
webhook:
444+
enabled: true
445+
replicaCount: 3 # Can be >1
446+
persistence:
447+
enabled: true
448+
type: emptyDir # or enabled: false
449+
deploymentStrategy:
450+
type: RollingUpdate
451+
rollingUpdate:
452+
maxSurge: 25%
453+
maxUnavailable: 25%
454+
```
455+
364456
## High Availability Setup
365457

366458
The chart supports two deployment modes for the main n8n component:
@@ -517,6 +609,7 @@ worker:
517609

518610
# here you can override the livenessProbe for the main container
519611
# it may be used to increase the timeout for the livenessProbe (e.g., to resolve issues like
612+
520613
livenessProbe:
521614
httpGet:
522615
path: /healthz
@@ -543,6 +636,12 @@ worker:
543636
# List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started.
544637
# See https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
545638
initContainers: []
639+
# - name: init-data-dir
640+
# image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
641+
# command: [ "/bin/sh", "-c", "mkdir -p /home/node/.n8n/" ]
642+
# volumeMounts:
643+
# - name: data
644+
# mountPath: /home/node/.n8n
546645

547646
service:
548647
annotations: {}

charts/n8n/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: n8n
3-
version: 1.0.4
3+
version: 1.1.0
44
appVersion: 1.81.4
55
type: application
66
description: "Helm Chart for deploying n8n on Kubernetes, a fair-code workflow automation platform with native AI capabilities for technical teams. Easily automate tasks across different services."

charts/n8n/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,15 @@ app.kubernetes.io/instance: {{ .Release.Name }}
125125
{{- fail "Webhook processes rely on Valkey. Please set valkey.enabled=true when webhook.enabled=true" -}}
126126
{{- end -}}
127127
{{- end }}
128+
129+
{{/*
130+
Validate values for n8n deployment
131+
*/}}
132+
{{- define "n8n.validateValues" -}}
133+
{{- if and (not .Values.main.statefulSet.enabled) (gt (int .Values.main.replicaCount) 1) (ne .Values.main.persistence.type "emptyDir") -}}
134+
{{- fail "\nERROR: Invalid configuration\nWhen using Deployment (statefulSet.enabled=false) with persistent storage, replicaCount must be 1.\nTo use multiple replicas either:\n 1. Enable StatefulSet (requires Enterprise license)\n 2. Use emptyDir for persistence (data will be lost on pod restart)" -}}
135+
{{- end -}}
136+
{{- if and .Values.webhook.enabled .Values.webhook.persistence.enabled (ne .Values.webhook.persistence.type "emptyDir") (gt (int .Values.webhook.replicaCount) 1) -}}
137+
{{- fail "\nERROR: Invalid webhook configuration\nWhen using persistent storage for webhook component, replicaCount must be 1.\nTo use multiple replicas either:\n 1. Disable persistence\n 2. Use emptyDir for persistence (data will be lost on pod restart)" -}}
138+
{{- end -}}
139+
{{- end -}}

charts/n8n/templates/deployment.webhook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{- if .Values.webhook.enabled }}
22
{{- /* Validate Valkey/Redis configuration */}}
33
{{- include "n8n.validateValkey" . }}
4+
{{- include "n8n.validateValues" . }}
45
apiVersion: apps/v1
56
kind: Deployment
67
metadata:

charts/n8n/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if not .Values.main.statefulSet.enabled }}
2+
{{- include "n8n.validateValues" . }}
23
apiVersion: apps/v1
34
kind: Deployment
45
metadata:

0 commit comments

Comments
 (0)