apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: '23' name: n8n namespace: n8n spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: n8n strategy: type: Recreate template: metadata: annotations: kubectl.kubernetes.io/restartedAt: '2026-03-16T18:41:14Z' labels: app: n8n spec: containers: - env: - name: TZ value: Europe/Madrid - name: N8N_SECURE_COOKIE value: 'false' - name: WEBHOOK_URL value: https://n8n.chemavx.xyz - name: N8N_EDITOR_BASE_URL value: https://n8n.chemavx.xyz - name: N8N_PROTOCOL value: https - name: N8N_HOST value: n8n.chemavx.xyz - name: DB_TYPE value: postgresdb - name: DB_POSTGRESDB_HOST value: postgres - name: DB_POSTGRESDB_PORT value: '5432' - name: DB_POSTGRESDB_DATABASE valueFrom: secretKeyRef: key: POSTGRES_DB name: n8n-postgres-secret - name: DB_POSTGRESDB_USER valueFrom: secretKeyRef: key: POSTGRES_USER name: n8n-postgres-secret - name: DB_POSTGRESDB_PASSWORD valueFrom: secretKeyRef: key: POSTGRES_PASSWORD name: n8n-postgres-secret - name: NODE_FUNCTION_ALLOW_BUILTIN value: https,fs envFrom: - secretRef: name: n8n-auth image: n8nio/n8n:latest imagePullPolicy: Always name: n8n ports: - containerPort: 5678 protocol: TCP resources: limits: cpu: '1' memory: 1Gi requests: cpu: 500m memory: 512Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /home/node/.n8n name: n8n-data dnsPolicy: ClusterFirst initContainers: - command: - sh - -c - "until nc -z postgres 5432; do\n echo \"Waiting for postgres...\"; sleep\ \ 2\ndone\necho \"Postgres is ready\"\n" env: - name: NODE_FUNCTION_ALLOW_BUILTIN value: https,fs image: busybox:1.36 imagePullPolicy: IfNotPresent name: wait-for-postgres resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 volumes: - name: n8n-data persistentVolumeClaim: claimName: n8n-pvc --- apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: '1' name: postgres namespace: n8n spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: postgres strategy: type: Recreate template: metadata: labels: app: postgres spec: containers: - env: - name: PGDATA value: /var/lib/postgresql/data/pgdata envFrom: - secretRef: name: n8n-postgres-secret image: postgres:16-alpine imagePullPolicy: IfNotPresent name: postgres ports: - containerPort: 5432 protocol: TCP readinessProbe: exec: command: - pg_isready - -U - n8n - -d - n8n failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 5 successThreshold: 1 timeoutSeconds: 1 resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /var/lib/postgresql/data name: postgres-data dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 volumes: - name: postgres-data persistentVolumeClaim: claimName: postgres-pvc