# Zero Trust Network — OpenZiti & FluxCD Reference Architecture

**Public version:** v1.0.0 · **Published:** 2026-11-29

**Sanitized public reference implementation of the Dark Gravity GitOps Control Plane.** A production-grade GitOps platform combining Zero Trust Networking (OpenZiti) with Declarative Infrastructure (FluxCD) to deliver a secure, scalable LLMOps and agentic development environment.

> This repository is a **reference architecture**: it documents the topology, policies and operational discipline of a running platform. Live infrastructure definitions, secrets, environment-specific values, private endpoints, and private repository names remain in a private control-plane repository.

## 📊 Operating Record (public metrics)


| Metric                    | Value                                                                                            | Evidence                              |
| ------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------- |
| Inbound attack surface    | **0 public listening ports** (all services ClusterIP, identity-based access)                     | Zero Trust overlay design             |
| Vulnerability remediation | **720+ findings remediated**, Trivy-verified with post-remediation re-scans                      | Cluster-wide security audit, May 2026 |
| Security baseline         | **NSA-hardened**: default-deny NetworkPolicies, non-root, read-only rootfs, least-privilege RBAC | Policy audit, zero misconfigurations  |
| Operation                 | **30+ services, single operator, 12+ months continuous GitOps reconciliation**                   | Commit history, Flux status           |
| Agent governance          | **Human-approved merges only** (HITL gate on every autonomous PR)                                | Public factory repos                  |


## 📋 Table of Contents

- [Overview](#-overview)
- [Key Features](#-key-features)
- [Cluster Overview](#-cluster-overview)
- [Architecture](#-architecture)
- [Code Factory Roadmap (CA/CD)](#-code-factory-roadmap-cacd)
- [Service Catalog](#-service-catalog)
- [Getting Started](#-getting-started)
- [Operations & Troubleshooting](#-operations--troubleshooting)
- [Security](#-security)
- [References](#-references)

## 🎯 Overview

This platform implements a **Zero Trust Development and LLMOps Environment** where:

- **No services are exposed to the internet** — all access is identity-based through OpenZiti
- **Everything is code** — 100% GitOps-driven infrastructure using FluxCD
- **Security by default** — cryptographic identities, end-to-end encryption, and OIDC authentication
- **Production-ready** — high-availability databases, observability, and secrets management
- **GPU-accelerated AI** — NVIDIA GPU with time-slicing for concurrent LLM workloads

### 🛡️ Dark Gravity Integration & Technological Sovereignty Policy

This platform serves as the **GitOps Control Plane and Infrastructure Reconciler** for the [Dark Gravity Autonomous CA/CD Software Factory](https://github.com/lgcorzo).

**1. Architectural Role in Dark Gravity**

- **Pull-Based Infrastructure Reconciliation:** driven 100% by FluxCD v2 across 10 segregated namespaces (`flux-system`, `orchestrators`, `agents`, `development`, `storage`, `knowledge`, `llm-apps`, `security`, `openziti`, `confluent`). The factory operates **without incoming SSH or external API push privileges**; state is reconciled continuously from Git via Server-Side Apply.
- **Air-Gapped & Zero Ingress Ports:** replaces inbound HTTP webhooks with outbound polling daemons (factory poller) and OpenZiti mTLS 1.3 encrypted mesh tunnels, completely closing the perimeter attack surface.
- **Storage Tier Reconciler:** deploys and manages a sovereign MinIO S3 tenant, CSI drivers (DirectPV), and the Key Encryption Server (KES), isolating runtime buckets (factory artifacts, agent checkpoints, provenance, documents, MLflow).

**2. Technological Sovereignty & Supply-Chain Hardening**

- **Sovereign Manifest Continuity:** when upstream cloud tools shift licensing or restrict open-source distribution, this control plane maintains hardened, self-hosted deployment blueprints ensuring uninterrupted operations.
- **Sealed Secrets & Zero Credential Exposure:** all secrets are encrypted via `kubeseal` asymmetric cryptography with zero plaintext secrets in Git, designed to facilitate auditing and traceability.
- **Regulatory Roadmap:** designed to support future alignment with SOC 2 Type II and the **EU AI Act** (traceability, human oversight, documentation). *Stated as a roadmap objective — not a claimed certification.*

**Use cases:** secure ML experimentation, zero trust remote development, privacy-focused workflow automation, air-gap-capable infrastructure, multi-provider LLM gateway with cost tracking.

## ✨ Key Features


| Feature                  | Description                                                               |
| ------------------------ | ------------------------------------------------------------------------- |
| 🔐 Zero Trust Networking | OpenZiti overlay network — no public ports, identity-based access         |
| 🔄 GitOps Automation     | FluxCD continuous reconciliation from Git source of truth                 |
| 🔑 Centralized IAM       | Keycloak OIDC for unified authentication across all services              |
| 📊 Full Observability    | Prometheus, Grafana, Loki, Tempo with OpenTelemetry + remote monitoring   |
| 🤖 MLOps Platform        | MLflow with secure artifact storage and experiment tracking               |
| 🏭 CA/CD Orchestration   | Hatchet + KEDA for autonomous agent workflows                             |
| 💻 Cloud IDE             | VS Code Remote via SSH over Ziti tunnel                                   |
| 🔒 Secrets Management    | Sealed Secrets for GitOps-friendly encryption                             |
| 🎮 GPU Support           | NVIDIA GPU with time-slicing, DCGM exporter monitoring                    |
| 🌐 Multi-LLM Gateway     | LiteLLM routing to multiple cloud and local providers, with cost tracking |


## 📊 Cluster Overview


| Item         | Value                                                                               |
| ------------ | ----------------------------------------------------------------------------------- |
| Cluster type | MicroK8s (single node, sovereign bare-metal)                                        |
| GPU          | Consumer-grade NVIDIA GPU (12 GB) with time-slicing (device plugin + runtime class) |
| GitOps       | 100% FluxCD-managed infrastructure                                                  |
| Zero Trust   | OpenZiti overlay network                                                            |
| Monitoring   | Local stack + remote (cloud) forwarding                                             |


### Namespace Summary


| Namespace        | Purpose                | Key Components                                                |
| ---------------- | ---------------------- | ------------------------------------------------------------- |
| `cert-manager`   | Certificate management | cert-manager, trust-manager                                   |
| `confluent`      | Event streaming        | Kafka (KRaft), Operator                                       |
| `flux-system`    | GitOps control plane   | FluxCD controllers                                            |
| `llm-apps`       | LLM applications       | OpenWebUI, LiteLLM, R2R, Ollama, MLflow, Docling, Tika        |
| `monitoring`     | Observability          | Prometheus, Grafana, Loki, Tempo, OTel, DCGM                  |
| `openziti`       | Zero trust network     | Ziti controller, edge router                                  |
| `orchestrators`  | Workflow & scaling | Hatchet, KEDA                                                 |
| `sealed-secrets` | Secret encryption      | Sealed Secrets controller                                     |
| `security`       | Identity & access  | Keycloak, operator, PostgreSQL                                |
| `storage`        | Data layer             | MinIO, CloudNativePG, Redis, RabbitMQ, Elasticsearch, MongoDB |
| `development`    | Dev environment        | VS Code SSH server                                            |
| `agents`         | Agent workforce        | Agentic coding engine, MCP tool server, gVisor sandbox        |


## 🏗 Architecture

### High-Level System Architecture

```mermaid
flowchart TD
    GH["Git Repository (Source of Truth)"] -->|"Reconcile"| FLUX["FluxCD Sync"]
    ADMIN["Operator / Dev (Ziti Tunneler)"] -->|"Zero Trust Identity"| ZR["Ziti Edge Router"]
    GCLOUD["Remote Monitoring"] <-.->|"Remote Write"| OTEL["OpenTelemetry Collector"]

    FLUX -->|"Deploy / Track"| ZC["Ziti Controller"]
    FLUX --> KC["Keycloak IAM"]
    FLUX --> OW["OpenWebUI"]
    FLUX --> LLM["LiteLLM Gateway"]
    FLUX --> ML["MLflow"]
    FLUX --> VSCODE["VS Code SSH"]
    FLUX --> OC["Agent Workers"]
```

### Zero Trust Connectivity Flow

```mermaid
sequenceDiagram
    participant User as User Device
    participant ZT as Ziti Tunneler
    participant ZR as Ziti Router
    participant ZC as Ziti Controller
    participant SVC as Service (e.g. Grafana)
    User->>ZT: Enroll with JWT
    ZT->>ZC: Authenticate identity
    ZC-->>ZT: Issue certificate
    User->>ZT: Request https://service.ziti
    ZT->>ZC: Query service policies
    ZC-->>ZT: Return authorized routes
    ZT->>ZR: Establish encrypted tunnel
    ZR->>SVC: Forward to service
    SVC-->>ZR: Response
    ZR-->>ZT: Encrypted response
    ZT-->>User: Display content
    Note over ZT,SVC: All traffic encrypted end-to-end. No public ports exposed.
```

## 🏭 Code Factory Roadmap (CA/CD)

> **Continuous Agentic / Continuous Deployment (CA/CD)** — an autonomous agent workforce that transforms mission requests into production-ready pull requests, running entirely inside the Zero Trust cluster.


| Component             | Status     | Namespace       | Description                                             |
| --------------------- | ---------- | --------------- | ------------------------------------------------------- |
| Hatchet               | ✅ Deployed | `orchestrators` | Durable workflow orchestrator (PostgreSQL + RabbitMQ)   |
| R2R                   | ✅ Deployed | `llm-apps`      | Graph RAG engine with pgvector for semantic code search |
| LiteLLM               | ✅ Deployed | `llm-apps`      | Model gateway with OIDC and budget governance           |
| MinIO                 | ✅ Deployed | `storage`       | Shared workspace for agent artifacts and code cache     |
| Kafka                 | ✅ Deployed | `confluent`     | Event streaming for mission input/output                |
| KEDA                  | ✅ Deployed | `orchestrators` | Event-driven autoscaler for agent workers               |
| Agent Workspace       | ✅ Deployed | `llm-apps`      | PVC + MinIO bucket for agent file storage               |
| Agentic coding engine | ✅ Deployed | `agents`        | Hatchet workers generating PRs                          |
| MCP tool server       | ✅ Deployed | `agents`        | Consolidated tool server (Planner / Tester / Reviewer)  |
| gVisor sandbox        | ✅ Deployed | `agents`        | Kernel-isolated job for untrusted code execution        |


```mermaid
flowchart LR
    OWUI["OpenWebUI"] --> KAFKA["Kafka"]
    KAFKA --> HATCHET["Hatchet"]
    KEDA["KEDA"] -->|"Scale"| OC["Agent Workers"]
    HATCHET -->|"Assign"| OC
    OC -->|"Tools"| MCP["MCP Server"]
    MCP -->|"Context"| R2R["R2R RAG"]
    MCP -->|"LLM"| LITELLM["LiteLLM"]
    OC -->|"Untrusted code"| GV["gVisor Sandbox"]
    GV -->|"Artifacts"| MINIO["MinIO"]
    GV -->|"PRs"| GIT["Git (human merge gate)"]
```

## 📦 Service Catalog (Reference)


| Tier                | Services                                                                     | Pattern                                                            |
| ------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| Identity            | Keycloak (OIDC realm) + CloudNativePG                                        | All web services behind OAuth2-Proxy or native OIDC                |
| Storage             | MinIO (S3), CloudNativePG (HA), Redis, RabbitMQ, Elasticsearch, MongoDB      | Operator-managed, bucket isolation per workload                    |
| Observability       | Prometheus, Grafana (OIDC + Ziti sidecar), Loki, Tempo, OTel Collector, DCGM | Local storage + remote forwarding                                  |
| ML lifecycle        | MLflow (4-container pod: app + OAuth2-Proxy + Nginx + Ziti)                  | Artifacts in MinIO, HA PostgreSQL backend                          |
| Event streaming     | Kafka (KRaft, no ZooKeeper) + ServiceMonitor                                 | Internal-only listeners                                            |
| Orchestration       | Hatchet (6-container pod) + KEDA                                             | Durable workflows, RabbitMQ task queue                             |
| Document processing | Docling, Apache Tika                                                         | CPU multi-format parsing + OCR feeding RAG                         |
| Development         | VS Code Remote over SSH via Ziti, namespaced RBAC                            | Key-based auth, read-only cluster-wide                             |
| GenAI               | OpenWebUI, LiteLLM (multi-provider routing + fallbacks), R2R, Ollama (GPU)   | Every pod carries an OAuth2-Proxy + Nginx TLS + Ziti sidecar chain |


## 🚀 Getting Started

```bash
# 1. Bootstrap FluxCD against your GitOps repository
flux bootstrap github \
  --owner=<your-org> \
  --repository=<your-gitops-repo> \
  --path=clusters/local-microk8s

# 2. Install the Ziti tunneler on your workstation
#    Linux: https://get.openziti.io (ziti-edge-tunnel)
#    Windows/macOS: Ziti Desktop Edge

# 3. Enroll an identity issued by the controller (JWT), then
#    services become reachable as https://<service>.ziti
```

All service access follows the same model: enroll a cryptographic identity, and only the `.ziti` services your policies allow are intercepted and routed. No VPN, no port-forwarding, no public endpoints.

## 🔧 Operations & Troubleshooting

```bash
# FluxCD reconciliation status
flux get kustomizations

# All Helm releases across namespaces
kubectl get helmreleases --all-namespaces

# GPU status
kubectl describe node | grep -A5 nvidia

# Force reconciliation
flux reconcile kustomization infrastructure --with-source
```

```bash
# Seal a secret (zero plaintext in Git)
kubectl create secret generic my-secret \
  --namespace my-namespace \
  --from-literal=key=value \
  --dry-run=client -o yaml | \
  kubeseal --controller-name=sealed-secrets-controller \
  --controller-namespace=sealed-secrets \
  --format yaml > sealed-secret.yaml
```


| Issue              | Symptom                   | Resolution                                       |
| ------------------ | ------------------------- | ------------------------------------------------ |
| DNS resolution     | `dig` returns REFUSED     | Verify identity permissions and service policies |
| Connection refused | `curl` fails              | Check tunneler logs and Ziti terminators         |
| Enrollment timeout | Context deadline exceeded | Verify controller/router reachability            |
| Auth failure       | 401 Unauthorized          | Re-create identity and enroll immediately        |
| Pod not ready      | CrashLoopBackOff          | Check dependency readiness (DB, cache)           |
| GPU not available  | Pod pending               | Verify NVIDIA device plugin and runtime class    |


## 🛡 Security

### Security Architecture ("Verify, then Trust")

1. **Zero Trust Networking (OpenZiti).** Dark services: all workloads use ClusterIP with zero public listening ports; access gated by cryptographic identities, not IP addresses; defense in depth via cert-manager PKI + OpenZiti overlay.
2. **GitOps & Secrets Management.** Immutability: FluxCD reverts unauthorized manual changes; Sealed Secrets enable GitOps without leaking sensitive data; every security change is captured in Git history.
3. **Identity & Access Management.** Keycloak as centralized OIDC provider prevents identity silos; all web services integrate via OAuth2-Proxy or native OIDC.
4. **Micro-Segmentation (Network Policies).** Default deny: all inter-namespace traffic blocked by default; explicit allow-lists only (app→DB, app→OIDC); strictly controlled egress to cluster DNS.

### 🛡️ Vulnerability & Security Audit (May 2026)

A cluster-wide security audit was completed using Trivy, confirming the success of a 5-phase remediation roadmap and establishing a hardened security baseline.


| Severity | Before (audit start) | After (9 days later) | Net Reduction |
| -------- | -------------------- | -------------------- | ------------- |
| CRITICAL | 429                  | 396                  | **-33**       |
| HIGH     | 3,660                | 2,973                | **-687**      |


**Audit highlights:**

- **Image hardening:** 100% of custom workloads migrated from `:latest` to pinned, stable versions.
- **RBAC maturation:** removed wildcard `*` verbs from custom ClusterRoles, enforcing least privilege.
- **Documented exceptions:** remaining findings categorized as Accepted Upstream Risks (controllers, drivers, base libraries).
- **Full verification:** passed all post-remediation re-scans for NetworkPolicies, Pod Security, and RBAC compliance.

### Hardening Status


| Area                                 | Status                     |
| ------------------------------------ | -------------------------- |
| Network Policies (NSA hardening)     | ✅ Complete                 |
| RBAC hardening                       | ✅ Verified                 |
| Container scanning & remediation | ✅ 720+ findings remediated |
| Workload security contexts           | ✅ NSA-compliant            |
| OpenZiti policies (ABAC transition)  | 🟡 In progress             |
| Loki long-term storage on S3         | 🟡 In progress             |


## 📚 References

- [OpenZiti Documentation](https://openziti.io)
- [FluxCD Documentation](https://fluxcd.io)
- [Keycloak Documentation](https://www.keycloak.org/documentation)
- [MLflow Documentation](https://mlflow.org/docs)
- [LiteLLM Documentation](https://docs.litellm.ai)
- [Hatchet Documentation](https://docs.hatchet.dev)
- Dark Gravity factory repositories: [github.com/lgcorzo](https://github.com/lgcorzo)

**Strategic goals:** security first (zero public exposure) · GitOps-driven reliability (100% infrastructure as code) · scalable LLMOps (GPU-accelerated, multi-provider) · platform autonomy (air-gap capable) · autonomous engineering (CA/CD agent pipeline with human merge gates).

---

*Built with OpenZiti, FluxCD, and Kubernetes.*