feat: poimen-sandbox namespace + security hardening + RBAC

Phase 1: sandbox namespace with PSA restricted enforcement,
ResourceQuota (20 pods, 10/20 CPU, 20/40Gi memory), and
CiliumNetworkPolicy denying pi-session egress to kube-apiserver.

Phase 2: sandbox-observer Role + poimen-devs RoleBinding for
OIDC-authenticated kubectl access to sandbox pod status/logs.
This commit is contained in:
2026-09-28 23:15:25 +08:00
parent c472a994ce
commit 8bd40c5152
6 changed files with 60 additions and 0 deletions
+3
View File
@@ -6,3 +6,6 @@ kind: Kustomization
# deployments (wave 0) are applied. # deployments (wave 0) are applied.
resources: resources:
- memory-db.yaml - memory-db.yaml
- poimen-sandbox-namespace.yaml
- poimen-sandbox-quota.yaml
- pi-session-netpol.yaml
+12
View File
@@ -0,0 +1,12 @@
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: pi-session-deny-kube-api
namespace: poimen-sandbox
spec:
endpointSelector:
matchLabels:
app: pi-session
egressDeny:
- toEntities:
- kube-apiserver
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Namespace
metadata:
name: poimen-sandbox
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: latest
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ResourceQuota
metadata:
name: sandbox-quota
namespace: poimen-sandbox
spec:
hard:
pods: "20"
requests.cpu: "10"
requests.memory: 20Gi
limits.cpu: "20"
limits.memory: 40Gi
+1
View File
@@ -16,6 +16,7 @@ resources:
- temporal-operator-role.yaml - temporal-operator-role.yaml
- llm-serving-operator-role.yaml - llm-serving-operator-role.yaml
- poimen-memory-operator-role.yaml - poimen-memory-operator-role.yaml
- sandbox-observer-role.yaml
# paperless's Role/RoleBinding lives in k8s/apps/paperless/rbac.yaml instead - # paperless's Role/RoleBinding lives in k8s/apps/paperless/rbac.yaml instead -
# that app already has its own kustomization + namespace, no need to # that app already has its own kustomization + namespace, no need to
# duplicate it here. All of these stay inert (grant nothing) until # duplicate it here. All of these stay inert (grant nothing) until
+23
View File
@@ -0,0 +1,23 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: sandbox-observer
namespace: poimen-sandbox
rules:
- apiGroups: [""]
resources: [pods, pods/log, services]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: poimen-devs-sandbox
namespace: poimen-sandbox
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: "oidc:poimen-devs"
roleRef:
kind: Role
name: sandbox-observer
apiGroup: rbac.authorization.k8s.io