Skip to content

Instantly share code, notes, and snippets.

@kenriortega
Forked from khpraful/n8n configuration files
Created September 9, 2022 12:36
Show Gist options
  • Save kenriortega/cb973d8a59b6bd51cb15d89f62e7fd36 to your computer and use it in GitHub Desktop.
Save kenriortega/cb973d8a59b6bd51cb15d89f62e7fd36 to your computer and use it in GitHub Desktop.
n8n configuration files for kubernetes deployment
n8n configuration files for kubernetes deployment
apiVersion: v1
kind: ConfigMap
metadata:
name: n8n-configmap
namespace: default
labels:
app: n8n
component: configmap
data:
DB_TYPE: "postgresdb"
DB_TABLE_PREFIX: "n8n"
DB_POSTGRESDB_USER: "n8n"
DB_POSTGRESDB_DATABASE: "n8n"
DB_POSTGRESDB_HOST: "postgres-service"
DB_POSTGRESDB_PORT: "5432"
EXECUTIONS_MODE: "queue"
QUEUE_BULL_REDIS_HOST: "redis-service"
QUEUE_BULL_REDIS_PORT: "6379"
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n-deployment
namespace: default
labels: &labels
app: n8n
component: deployment
spec:
replicas: 1
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
spec:
containers:
- name: n8n
image: n8nio/n8n:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5678
envFrom:
- configMapRef:
name: n8n-configmap
- secretRef:
name: n8n-secrets
livenessProbe:
httpGet:
path: /healthz
port: 5678
readinessProbe:
httpGet:
path: /healthz
port: 5678
resources:
limits:
cpu: "1.0"
memory: "1024Mi"
requests:
cpu: "0.5"
memory: "512Mi"
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: n8n-secrets
namespace: default
labels:
app: n8n
component: secrets
stringData:
# Database password
DB_POSTGRESDB_PASSWORD: "n8n"
# Basic auth credentials
N8N_BASIC_AUTH_PASSWORD: "n8n"
# Encryption key to hash all data
N8N_ENCRYPTION_KEY: "n8n"
apiVersion: v1
kind: Service
metadata:
name: n8n-service
namespace: default
labels:
app: n8n
component: service
spec:
type: LoadBalancer
selector:
app: n8n
component: deployment
ports:
- protocol: TCP
name: http
port: 80
targetPort: 5678
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n-worker-deployment
namespace: default
labels: &labels
app: n8n-worker
component: deployment
spec:
replicas: 2
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
spec:
containers:
- name: n8n-worker
image: n8nio/n8n:latest
command: ["n8n"]
args: ["worker"]
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5678
envFrom:
- configMapRef:
name: n8n-configmap
- secretRef:
name: n8n-secrets
# livenessProbe:
# httpGet:
# path: /healthz
# port: 5678
# readinessProbe:
# httpGet:
# path: /healthz
# port: 5678
resources:
limits:
cpu: "1.0"
memory: "1024Mi"
requests:
cpu: "0.5"
memory: "512Mi"
apiVersion: v1
kind: Service
metadata:
name: n8n-worker-service
namespace: default
labels:
app: n8n-worker
component: service
spec:
type: NodePort
selector:
app: n8n-worker
component: deployment
ports:
- protocol: TCP
name: http
port: 80
targetPort: 5678
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: postgres-secrets
namespace: default
labels:
app: postgres
component: secrets
stringData:
PGDATA: "/var/lib/postgresql/data/pgdata"
POSTGRES_USER: "n8n"
POSTGRES_DB: "n8n"
POSTGRES_PASSWORD: "n8n"
apiVersion: v1
kind: Service
metadata:
name: postgres-service
namespace: default
labels: &labels
app: postgres
component: service
spec:
clusterIP: None
selector:
app: postgres
component: statefulset
ports:
- name: postgres
port: 5432
targetPort: 5432
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres-statefulset
namespace: default
labels: &labels
app: postgres
component: statefulset
spec:
serviceName: postgres-statefulset
replicas: 1
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
spec:
containers:
- name: postgres
image: postgres:latest
ports:
- name: postgres
containerPort: 5432
envFrom:
- secretRef:
name: postgres-secrets
apiVersion: v1
kind: Service
metadata:
name: redis-service
namespace: default
labels: &labels
app: redis
component: service
spec:
type: NodePort
selector:
app: redis
component: statefulset
ports:
- name: postgres
port: 6379
targetPort: 6379
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-statefulset
namespace: default
labels: &labels
app: redis
component: statefulset
spec:
serviceName: redis-statefulset
replicas: 1
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
spec:
containers:
- name: redis
image: redis:latest
ports:
- name: redis
containerPort: 6379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment