Files
n8n/templates/deployment.yaml
claude 87b2a833cc
Helm Chart Release / release-chart (push) Successful in 4s
fix: auto-detect N8N_SECURE_COOKIE from Ingress/TLS settings
Set N8N_SECURE_COOKIE=true only when ingress.enabled=true AND ingress.tls
is configured. All other cases (LoadBalancer, HTTP Ingress) default to false,
eliminating the secure cookie error without manual configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 18:24:10 +09:00

156 lines
5.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "n8n.fullname" . }}
labels:
{{- include "n8n.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "n8n.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "n8n.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "n8n.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: n8n
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 5678
protocol: TCP
env:
- name: N8N_PORT
value: "5678"
- name: N8N_PROTOCOL
value: {{ .Values.n8n.protocol | quote }}
- name: N8N_HOST
value: {{ .Values.n8n.host | quote }}
{{- if .Values.n8n.webhookUrl }}
- name: WEBHOOK_URL
value: {{ .Values.n8n.webhookUrl | quote }}
{{- end }}
- name: GENERIC_TIMEZONE
value: {{ .Values.n8n.timezone | quote }}
- name: N8N_LOG_LEVEL
value: {{ .Values.n8n.logLevel | quote }}
- name: N8N_USER_FOLDER
value: "/home/node/.n8n"
- name: N8N_ENCRYPTION_KEY
valueFrom:
secretKeyRef:
name: {{ include "n8n.secretName" . }}
key: encryption-key
{{- if .Values.n8n.basicAuth.enabled }}
- name: N8N_BASIC_AUTH_ACTIVE
value: "true"
- name: N8N_BASIC_AUTH_USER
value: {{ .Values.n8n.basicAuth.user | quote }}
- name: N8N_BASIC_AUTH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.n8n.basicAuth.existingSecret | default (include "n8n.fullname" .) }}
key: {{ .Values.n8n.basicAuth.passwordKey }}
{{- end }}
- name: N8N_SECURE_COOKIE
{{- if and .Values.ingress.enabled .Values.ingress.tls }}
value: "true"
{{- else }}
value: "false"
{{- end }}
- name: EXECUTIONS_DATA_PRUNE
value: {{ .Values.n8n.executions.pruneData | quote }}
- name: EXECUTIONS_DATA_MAX_AGE
value: {{ .Values.n8n.executions.pruneDataMaxAge | quote }}
- name: EXECUTIONS_DATA_MAX_COUNT
value: {{ .Values.n8n.executions.pruneDataMaxCount | quote }}
- name: DB_TYPE
value: {{ .Values.n8n.database.type | quote }}
{{- if eq .Values.n8n.database.type "postgresdb" }}
- name: DB_POSTGRESDB_HOST
value: {{ .Values.n8n.database.postgresdb.host | quote }}
- name: DB_POSTGRESDB_PORT
value: {{ .Values.n8n.database.postgresdb.port | quote }}
- name: DB_POSTGRESDB_DATABASE
value: {{ .Values.n8n.database.postgresdb.database | quote }}
- name: DB_POSTGRESDB_USER
value: {{ .Values.n8n.database.postgresdb.user | quote }}
- name: DB_POSTGRESDB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.n8n.database.postgresdb.existingSecret | default (include "n8n.fullname" .) }}
key: {{ .Values.n8n.database.postgresdb.passwordKey }}
{{- end }}
{{- range $key, $val := .Values.n8n.extraEnv }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
volumeMounts:
- name: data
mountPath: /home/node/.n8n
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "n8n.pvcName" . }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}