fix(argo): add NetworkPolicy and security context for workflow pods
The default-deny-all NetworkPolicy blocks all egress for foxhunt-labeled pods. Argo workflow pods need: - Egress to MinIO (9000) for binary fetch and result upload - Egress to K8s API (443/6443) for executor task result reporting - Egress to Tempo (4317) for OTLP traces - DNS already covered by allow-dns policy Also fix PVC permission denied by setting fsGroup: 1000 to match the foxhunt user (UID 1000) in the runtime images. Smoke test fetch-binary step: Succeeded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
41
infra/k8s/argo/argo-workflow-netpol.yaml
Normal file
41
infra/k8s/argo/argo-workflow-netpol.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: argo-training-workflow
|
||||
namespace: foxhunt
|
||||
labels:
|
||||
app.kubernetes.io/part-of: foxhunt
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: training-workflow
|
||||
policyTypes:
|
||||
- Egress
|
||||
egress:
|
||||
# Kubernetes API — Argo executor reports task results
|
||||
- ports:
|
||||
- port: 443
|
||||
protocol: TCP
|
||||
- port: 6443
|
||||
protocol: TCP
|
||||
to:
|
||||
- ipBlock:
|
||||
cidr: 10.32.0.0/16
|
||||
- ipBlock:
|
||||
cidr: 172.16.0.4/32
|
||||
# MinIO — binary fetch + result upload
|
||||
- ports:
|
||||
- port: 9000
|
||||
protocol: TCP
|
||||
to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: minio
|
||||
# Tempo — OTLP traces
|
||||
- ports:
|
||||
- port: 4317
|
||||
protocol: TCP
|
||||
to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: tempo
|
||||
@@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- training-workflow-template.yaml
|
||||
- argo-workflow-netpol.yaml
|
||||
|
||||
@@ -9,6 +9,15 @@ metadata:
|
||||
spec:
|
||||
entrypoint: train-model
|
||||
serviceAccountName: argo-workflow
|
||||
# Label all workflow pods so network policies (MinIO, DNS) allow traffic
|
||||
podMetadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: foxhunt
|
||||
app.kubernetes.io/component: training-workflow
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
ttlStrategy:
|
||||
secondsAfterCompletion: 3600
|
||||
activeDeadlineSeconds: 21600
|
||||
|
||||
Reference in New Issue
Block a user