Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f15e4eb3c | ||
|
|
9e004ccb9b | ||
|
|
4e684b2ee2 | ||
|
|
13ec9afd32 | ||
|
|
c8e8b9532d | ||
|
|
d62ac3d861 | ||
|
|
b45ae269fd | ||
|
|
814f96040f |
@@ -159,54 +159,3 @@ spec:
|
|||||||
automated:
|
automated:
|
||||||
prune: true
|
prune: true
|
||||||
selfHeal: true
|
selfHeal: true
|
||||||
---
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
|
||||||
kind: Application
|
|
||||||
metadata:
|
|
||||||
name: kyverno
|
|
||||||
namespace: argocd
|
|
||||||
annotations:
|
|
||||||
argocd.argoproj.io/sync-wave: "0"
|
|
||||||
spec:
|
|
||||||
project: homelab
|
|
||||||
source:
|
|
||||||
repoURL: https://kyverno.github.io/kyverno/
|
|
||||||
chart: kyverno
|
|
||||||
targetRevision: "1.14.0"
|
|
||||||
helm:
|
|
||||||
valueFiles:
|
|
||||||
- $values/k8s/bootstrap/kyverno/kyverno-values.yaml
|
|
||||||
sources:
|
|
||||||
- repoURL: https://forgejo.riotpiao.com/riotpiao-poimen/homelab.git
|
|
||||||
targetRevision: main
|
|
||||||
ref: values
|
|
||||||
destination:
|
|
||||||
server: https://kubernetes.default.svc
|
|
||||||
namespace: kyverno
|
|
||||||
syncPolicy:
|
|
||||||
automated:
|
|
||||||
prune: true
|
|
||||||
selfHeal: true
|
|
||||||
syncOptions:
|
|
||||||
- CreateNamespace=true
|
|
||||||
---
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
|
||||||
kind: Application
|
|
||||||
metadata:
|
|
||||||
name: kyverno-policies
|
|
||||||
namespace: argocd
|
|
||||||
annotations:
|
|
||||||
argocd.argoproj.io/sync-wave: "0"
|
|
||||||
spec:
|
|
||||||
project: homelab
|
|
||||||
source:
|
|
||||||
repoURL: https://forgejo.riotpiao.com/riotpiao-poimen/homelab.git
|
|
||||||
targetRevision: main
|
|
||||||
path: k8s/bootstrap/kyverno
|
|
||||||
destination:
|
|
||||||
server: https://kubernetes.default.svc
|
|
||||||
namespace: kyverno
|
|
||||||
syncPolicy:
|
|
||||||
automated:
|
|
||||||
prune: true
|
|
||||||
selfHeal: true
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
# Keep the GraphQL server reachable only from the one service that proxies it.
|
||||||
|
#
|
||||||
|
# poimen-graphql is already off the internet: its Service is ClusterIP on 8090 and
|
||||||
|
# no Ingress names it. What it lacked is in-cluster isolation — a ClusterIP answers
|
||||||
|
# every pod in the cluster.
|
||||||
|
#
|
||||||
|
# The only caller is poimen-memory, whose /graphql route forwards the request body
|
||||||
|
# to MEM_GQL_PORT (8090). No other workload references this service.
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: poimen-graphql-ingress
|
||||||
|
namespace: poimen
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: poimen-graphql
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: poimen-memory
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8090
|
||||||
@@ -6,6 +6,10 @@ kind: Kustomization
|
|||||||
# deployments (wave 0) are applied.
|
# deployments (wave 0) are applied.
|
||||||
resources:
|
resources:
|
||||||
- memory-db.yaml
|
- memory-db.yaml
|
||||||
|
# ClusterIP alone is not isolation: every pod in the cluster can reach it.
|
||||||
|
- memory-db-netpol.yaml
|
||||||
|
# Only poimen-memory's /graphql proxy calls 8090.
|
||||||
|
- graphql-netpol.yaml
|
||||||
- poimen-sandbox-namespace.yaml
|
- poimen-sandbox-namespace.yaml
|
||||||
- poimen-sandbox-quota.yaml
|
- poimen-sandbox-quota.yaml
|
||||||
- pi-session-netpol.yaml
|
- pi-session-netpol.yaml
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
# Keep the memory database reachable only from inside its own namespace.
|
||||||
|
#
|
||||||
|
# What this does NOT change: the database was already unreachable from the
|
||||||
|
# internet. `memory-db-rw`, `memory-db-ro` and `memory-db-r` are ClusterIP
|
||||||
|
# services, no Ingress backs them, and no public DNS name resolves to them.
|
||||||
|
#
|
||||||
|
# What it fixes: a ClusterIP service is reachable by EVERY pod in the cluster,
|
||||||
|
# because Kubernetes has no implicit isolation. Cilium enforces NetworkPolicy, so
|
||||||
|
# stating the allowed sources is what turns "not on the internet" into "not
|
||||||
|
# reachable from another tenant's namespace".
|
||||||
|
#
|
||||||
|
# Two sources, both required:
|
||||||
|
# - the poimen namespace, which holds every client: poimen-memory, poimen-graphql,
|
||||||
|
# poimen-worker, poimen-workflows and the migration Job.
|
||||||
|
# - cnpg-system, where the CloudNativePG operator lives. It connects to the
|
||||||
|
# instance for switchover and failover, so a narrower rule breaks recovery.
|
||||||
|
#
|
||||||
|
# No other port is opened. The operator's metrics endpoint stays closed because no
|
||||||
|
# PodMonitor for this cluster exists, so nothing scrapes it.
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: memory-db-ingress
|
||||||
|
namespace: poimen
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
cnpg.io/cluster: memory-db
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: poimen
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: cnpg-system
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
Reference in New Issue
Block a user