Skip to main content
← All 10 Production Configurators
KUBERNETES & SECURITY · DEPLOYMENT-HPA-NETPOL.YAML · LIVE MISCONFIGURATION PHYSICS

Kubernetes Zero-Downtime Deployment, HPA & Cilium eBPF Generator

Generate kubectl-ready Kubernetes Deployment, PodDisruptionBudget, HPA, and Cilium eBPF default-deny NetworkPolicy with preStop drain hooks and kube-dns egress.

Zero-Downtime, Zero-Trust Kubernetes Service
3 HA replicas + PDB/HPA, 10s graceful endpoint drain, Cilium eBPF policy (with kube-dns:53), and non-root securityContext.
REAL-WORLD KNOBS (4)
3
Need >= 2 across AZs with PodDisruptionBudget to survive node drains.
10s
Gives kube-proxy/ALB time to remove endpoint before SIGTERM — eliminates rolling-deploy 502s.
K8s namespaces alone provide ZERO network isolation; eBPF locks egress to kube-dns + explicit ports.
Prevents container breakout and runtime binary tampering.
deployment-hpa-netpol.yaml · PARSER-VERIFIED
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api-service
  template:
    metadata:
      labels:
        app: api-service
    spec:
      terminationGracePeriodSeconds: 30
      containers:
        - name: app
          image: ghcr.io/acme/api-service:1.14.2
          ports:
            - containerPort: 8000
          resources:
            requests: { cpu: "500m", memory: "512Mi" }
            limits: { cpu: "1000m", memory: "1Gi" }
          securityContext:
            runAsNonRoot: true
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
          lifecycle:
            preStop:
              exec:
                command: ["/bin/sh", "-c", "sleep 10"]
          readinessProbe:
            httpGet: { path: /healthz, port: 8000 }
            periodSeconds: 5
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: api-service-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: api-service
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: api-service-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api-service
  minReplicas: 3
  maxReplicas: 12
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: api-zero-trust
spec:
  endpointSelector:
    matchLabels:
      app: api-service
  egress:
    - toEndpoints:
        - matchLabels:
            k8s:io.kubernetes.pod.namespace: kube-system
            k8s-app: kube-dns
      toPorts:
        - ports:
            - port: "53"
              protocol: UDP
            - port: "53"
              protocol: TCP
    - toEndpoints:
        - matchLabels:
            app: pgbouncer
      toPorts:
        - ports:
            - port: "6432"
              protocol: TCP
EXPLORE THIS COMPONENT IN ARCHOS STUDIO
Simulate Full Topology in ArchOS ↗60-Sec L4–L7 Diagnostic →
MATCHING PRODUCTION INCIDENT PLAYBOOKS
M11 · P0 · L7Zero-Trust CiliumNetworkPolicy DNS Blackhole & Rolling Deploy 502sRead Incident Playbook →