The Philosophy of “Dark” Kubernetes
Traditional self-hosted Kubernetes deployments face a persistent dilemma when exposed to the internet:
- Public API Exposure: Leaving port
6443open to the world relies entirely on the API server’s TLS and authentication layers. Automated bots constantly scan and probe this port. - Traditional VPNs (WireGuard / OpenVPN): Establishing a site-to-site or client-to-site VPN requires managing external firewall rules, IP routing tables, and complex split-DNS configurations, granting wide network access to anyone who connects.
Dark K3s takes an entirely different approach: Zero-Trust by Default.
The control plane is bound strictly to 127.0.0.1. Inbound port 6443 is completely closed on the public firewall. The cluster is reachable only through an end-to-end encrypted OpenZiti zero-trust overlay network. If you scan the server’s public IP address, the Kubernetes API server does not exist.
Architectural Topology

Core Pillars of the Architecture
1. Minimal Attack Surface (Host Hardening)
The host operating system is locked down immediately upon boot via the k3s_os_hardening Ansible role:
- Default DENY policy on incoming connections.
- Only the OpenZiti Controller (8441) and Edge Router (8442) listener ports are open externally.
- Port 6443 is restricted strictly to internal subnet CIDRs (Flannel VXLAN and internal cluster communication).
- SSH (port 22) is temporary and restricted to trusted admin IPs, with the long-term roadmap migrating SSH itself inside the Ziti overlay (“Zitified SSH”).
2. Declarative K3s Bootstrap
K3s is configured via /etc/rancher/k3s/config.yaml rather than fragile command-line flags or systemd overrides:
bind-address: "127.0.0.1"ensures the API server will not listen on public interfaces.tls-san: ["k3s.ziti"]embeds the zero-trust virtual domain name into the API server’s TLS certificate.- Traefik is disabled (
disable: ["traefik"]) in favor of explicit GitOps-driven ingress.
3. GitOps via Enterprise Flux D2
Clusters are not managed with imperative kubectl apply commands from a developer workstation. Instead, the cluster reconciles its state automatically via FluxCD following the Enterprise Flux D2 pattern:
- The entire monorepo is packaged into versioned, keyless-signed OCI artifacts (
ghcr.io/xnok/infra-bootstrap-tools/manifests/*). - The cluster pulls its desired state from GHCR on every push to
main. - Cluster configurations are decoupled into fleet (cluster-specific) and infra-addons (shared platform components).
4. Zero-Trust Mesh & Identity
All administrative and workload connectivity travels across OpenZiti:
- Workloads and developers authenticate using cryptographic identity certificates (SVIDs / JWTs).
- External OpenID Connect (OIDC) identity providers like Keycloak or Auth0 validate human operator identities.
- Administrators tunnel directly to
https://k3s.ziti:6443using the local Ziti clientβno open public ports, no dynamic DNS hassles, no VPN subnets.
Chapter Walkthrough
To understand or deploy the Dark K3s stack, explore the following documentation chapters:
- Node Hardening & Firewall (UFW): How UFW firewall policies isolate the host.
- K3s Bootstrap with Ansible: Declarative server and agent installation.
- Enterprise GitOps with Flux D2 & OCI: Monorepo OCI artifacts, fleet management, and values layering.
- Zero-Trust Mesh with OpenZiti: In-cluster router enrollment and tunnel access.
- Platform Add-ons & Identity: Cert-manager, trust-manager, and OIDC signers.
- Local Testing with Kind: Validating the whole GitOps and mesh stack locally on your workstation.