├── LICENSE ├── README.md ├── n8n-claim0-persistentvolumeclaim.yaml ├── n8n-deployment.yaml ├── n8n-service.yaml ├── namespace.yaml ├── postgres-claim0-persistentvolumeclaim.yaml ├── postgres-configmap.yaml ├── postgres-deployment.yaml ├── postgres-secret.yaml └── postgres-service.yaml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 n8n - Workflow Automation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Archived 2 | This repo isn't maintained anymore. Please use [n8n-hosting](https://github.com/n8n-io/n8n-hosting/tree/main/kubernetes) instead. 3 | 4 | -------------------------------------------------------------------------------- /n8n-claim0-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | labels: 5 | service: n8n-claim0 6 | name: n8n-claim0 7 | namespace: n8n 8 | spec: 9 | accessModes: 10 | - ReadWriteOnce 11 | resources: 12 | requests: 13 | storage: 2Gi 14 | -------------------------------------------------------------------------------- /n8n-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | service: n8n 6 | name: n8n 7 | namespace: n8n 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | service: n8n 13 | strategy: 14 | type: Recreate 15 | template: 16 | metadata: 17 | labels: 18 | service: n8n 19 | spec: 20 | initContainers: 21 | - name: volume-permissions 22 | image: busybox:1.36 23 | command: ["sh", "-c", "chown 1000:1000 /data"] 24 | volumeMounts: 25 | - name: n8n-claim0 26 | mountPath: /data 27 | containers: 28 | - command: 29 | - /bin/sh 30 | args: 31 | - -c 32 | - sleep 5; n8n start 33 | env: 34 | - name: DB_TYPE 35 | value: postgresdb 36 | - name: DB_POSTGRESDB_HOST 37 | value: postgres-service.n8n.svc.cluster.local 38 | - name: DB_POSTGRESDB_PORT 39 | value: "5432" 40 | - name: DB_POSTGRESDB_DATABASE 41 | value: n8n 42 | - name: DB_POSTGRESDB_USER 43 | valueFrom: 44 | secretKeyRef: 45 | name: postgres-secret 46 | key: POSTGRES_NON_ROOT_USER 47 | - name: DB_POSTGRESDB_PASSWORD 48 | valueFrom: 49 | secretKeyRef: 50 | name: postgres-secret 51 | key: POSTGRES_NON_ROOT_PASSWORD 52 | - name: N8N_PROTOCOL 53 | value: http 54 | - name: N8N_PORT 55 | value: "5678" 56 | image: n8nio/n8n 57 | name: n8n 58 | ports: 59 | - containerPort: 5678 60 | resources: 61 | requests: 62 | memory: "250Mi" 63 | limits: 64 | memory: "500Mi" 65 | volumeMounts: 66 | - mountPath: /home/node/.n8n 67 | name: n8n-claim0 68 | restartPolicy: Always 69 | volumes: 70 | - name: n8n-claim0 71 | persistentVolumeClaim: 72 | claimName: n8n-claim0 73 | - name: n8n-secret 74 | secret: 75 | secretName: n8n-secret 76 | - name: postgres-secret 77 | secret: 78 | secretName: postgres-secret 79 | -------------------------------------------------------------------------------- /n8n-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | service: n8n 6 | name: n8n 7 | namespace: n8n 8 | spec: 9 | type: LoadBalancer 10 | ports: 11 | - name: "5678" 12 | port: 5678 13 | targetPort: 5678 14 | protocol: TCP 15 | selector: 16 | service: n8n 17 | -------------------------------------------------------------------------------- /namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: n8n 5 | -------------------------------------------------------------------------------- /postgres-claim0-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: postgresql-pv 5 | namespace: n8n 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 300Gi 12 | -------------------------------------------------------------------------------- /postgres-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: init-data 5 | namespace: n8n 6 | data: 7 | init-data.sh: | 8 | #!/bin/bash 9 | set -e; 10 | if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then 11 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 12 | CREATE USER "${POSTGRES_NON_ROOT_USER}" WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}'; 13 | GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO "${POSTGRES_NON_ROOT_USER}"; 14 | EOSQL 15 | else 16 | echo "SETUP INFO: No Environment variables given!" 17 | fi -------------------------------------------------------------------------------- /postgres-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | service: postgres-n8n 6 | name: postgres 7 | namespace: n8n 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | service: postgres-n8n 13 | strategy: 14 | rollingUpdate: 15 | maxSurge: 1 16 | maxUnavailable: 1 17 | type: RollingUpdate 18 | template: 19 | metadata: 20 | labels: 21 | service: postgres-n8n 22 | spec: 23 | containers: 24 | - image: postgres:11 25 | name: postgres 26 | resources: 27 | limits: 28 | cpu: "4" 29 | memory: 4Gi 30 | requests: 31 | cpu: "1" 32 | memory: 2Gi 33 | ports: 34 | - containerPort: 5432 35 | volumeMounts: 36 | - name: postgresql-pv 37 | mountPath: /var/lib/postgresql/data 38 | - name: init-data 39 | mountPath: /docker-entrypoint-initdb.d/init-n8n-user.sh 40 | subPath: init-data.sh 41 | env: 42 | - name: PGDATA 43 | value: /var/lib/postgresql/data/pgdata 44 | - name: POSTGRES_USER 45 | valueFrom: 46 | secretKeyRef: 47 | name: postgres-secret 48 | key: POSTGRES_USER 49 | - name: POSTGRES_PASSWORD 50 | valueFrom: 51 | secretKeyRef: 52 | name: postgres-secret 53 | key: POSTGRES_PASSWORD 54 | - name: POSTGRES_DB 55 | value: n8n 56 | - name: POSTGRES_NON_ROOT_USER 57 | valueFrom: 58 | secretKeyRef: 59 | name: postgres-secret 60 | key: POSTGRES_NON_ROOT_USER 61 | - name: POSTGRES_NON_ROOT_PASSWORD 62 | valueFrom: 63 | secretKeyRef: 64 | name: postgres-secret 65 | key: POSTGRES_NON_ROOT_PASSWORD 66 | - name: POSTGRES_HOST 67 | value: postgres-service 68 | - name: POSTGRES_PORT 69 | value: '5432' 70 | restartPolicy: Always 71 | volumes: 72 | - name: postgresql-pv 73 | persistentVolumeClaim: 74 | claimName: postgresql-pv 75 | - name: postgres-secret 76 | secret: 77 | secretName: postgres-secret 78 | - name: init-data 79 | configMap: 80 | name: init-data 81 | defaultMode: 0744 82 | -------------------------------------------------------------------------------- /postgres-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | namespace: n8n 5 | name: postgres-secret 6 | type: Opaque 7 | stringData: 8 | POSTGRES_USER: changeUser 9 | POSTGRES_PASSWORD: changePassword 10 | POSTGRES_DB: n8n 11 | POSTGRES_NON_ROOT_USER: changeUser 12 | POSTGRES_NON_ROOT_PASSWORD: changePassword -------------------------------------------------------------------------------- /postgres-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | service: postgres-n8n 6 | name: postgres-service 7 | namespace: n8n 8 | spec: 9 | clusterIP: None 10 | ports: 11 | - name: "5432" 12 | port: 5432 13 | targetPort: 5432 14 | protocol: TCP 15 | selector: 16 | service: postgres-n8n 17 | --------------------------------------------------------------------------------