harden k3s workloads and ingress

This commit is contained in:
Alex
2026-11-03 19:04:59 -08:00
parent 664161d284
commit 2763f74ab0
14 changed files with 112 additions and 0 deletions
+9
View File
@@ -20,6 +20,9 @@ spec:
app: n8n
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: n8n
image: docker.n8n.io/n8nio/n8n:2.32.7
@@ -28,6 +31,12 @@ spec:
ports:
- containerPort: 5678
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
env:
# ------------------------------------------------
# n8n URL / reverse proxy
+1
View File
@@ -8,3 +8,4 @@ resources:
- deployment.yaml
- service.yaml
- ingress.yaml
- network-policy.yaml
+15
View File
@@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-from-traefik-and-namespace
namespace: n8n
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector: {}
+8
View File
@@ -14,11 +14,19 @@ spec:
labels:
app: n8n-postgres
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: postgres
image: postgres:17-alpine
ports:
- containerPort: 5432
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
env:
- name: POSTGRES_DB
value: n8n
+1
View File
@@ -11,3 +11,4 @@ resources:
- nightscout-deployment.yaml
- nightscout-service.yaml
- nightscout-ingress.yaml
- network-policy.yaml
+8
View File
@@ -15,12 +15,20 @@ spec:
labels:
app: mongodb
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: mongodb
image: mongo:4.4
ports:
- containerPort: 27017
name: mongo
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: mongo-data
mountPath: /data/db
+15
View File
@@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-from-traefik-and-namespace
namespace: nightscout
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector: {}
@@ -13,12 +13,20 @@ spec:
labels:
app: nightscout
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: nightscout
image: nightscout/cgm-remote-monitor:latest
ports:
- containerPort: 1337
name: http
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: nightscout-config
+1
View File
@@ -9,3 +9,4 @@ resources:
- vaultwarden-service.yaml
- vaultwarden-ingress.yaml
- vaultwarden-admin.yaml
- network-policy.yaml
+15
View File
@@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-from-traefik-and-namespace
namespace: vaultwarden
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector: {}
@@ -16,6 +16,9 @@ spec:
labels:
app: vaultwarden
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: vaultwarden
# Pinned deliberately: this migration should not also be an upgrade.
@@ -23,6 +26,11 @@ spec:
ports:
- name: http
containerPort: 80
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
env:
- name: DOMAIN
value: https://vault.aleshym.co
+1
View File
@@ -9,3 +9,4 @@ resources:
- vikunja-deployment.yaml
- vikunja-service.yaml
- vikunja-ingress.yaml
- network-policy.yaml
+15
View File
@@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-from-traefik-and-namespace
namespace: vikunja
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector: {}
+7
View File
@@ -26,12 +26,19 @@ spec:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: vikunja
image: vikunja/vikunja:2.6.0
ports:
- name: http
containerPort: 3456
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
env:
- name: VIKUNJA_SERVICE_PUBLICURL
value: https://vikunja.aleshym.co/