Kubernetes & n8n: Setup n8n using K8S (Part 2)
Summary
We have briefly discussed on automating various tasks using n8n and installation of n8n within Kubernetes in Part1. In this part, we mostly concentrate on how to enable TLS (for https) and terminate before it hits n8n
Pre-Reqs
- Setting up of n8n in Kubernetes ; Read Part1
- Knowledge of TLS, certificates
Summary Steps
- Ensure n8n is configured properly with by http
- Implement Kubernetes Ingress with https
- There are two options from here
- End to end TLS by redirecting proxy to n8n
- TLS termination at proxy and private network to be non-secure
- We follow the second option as it is easier, thus creating Ingress and pointing to n8n service
Steps
Steps in lab_server
- Ensure Certificate is created and implemented as a secret in Kubernetes preferably in same namespace
kubectl -n n8n create secret tls tls-secret --key test.key --cert test.crt
- Use the same tls-secret in the Ingress config
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: n8n-ingress
spec:
tls:
- hosts:
- n8n.mydev.test
secretName: tls-secret
rules:
- host: n8n.mydev.test
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: n8n
port:
number: 5678
---