Infrastructure Management: Core Concerns & Parity

The Universal Concerns of Infrastructure

When building a self-hosted platform—whether a single-node homelab on a budget VPS or a hardened multi-node edge deployment—it is tempting to focus solely on container orchestrator syntax (compose.yaml versus kustomization.yaml).

However, orchestrator engines are merely runtimes. Regardless of the tool chosen, every infrastructure stack must solve the exact same six fundamental concerns:

#Universal ConcernCore Responsibility
1Compute ProvisioningHow VMs, DNS, and cloud resources are created
2OS & Host HardeningMinimizing attack surface and firewall locking
3Orchestration EngineScheduling, clustering, and container lifecycle
4Cluster OperationsDeclarative delivery, visual UI, and GitOps
5Ingress & PerimeterExposing services, TLS certificates, and auth
6Secrets & Config MgmtInjection of credentials without Git leaks

infra-bootstrap-tools structures its automation around these universal concerns. By establishing strict architectural parity between Docker Swarm and Kubernetes (Dark K3s), you can navigate both stacks using the same mental model.


Architectural Parity & Mirroring

The diagram below illustrates how each track solves these six foundational concerns:

Architectural Parity: Docker Swarm vs Dark K3s


Detailed Breakdown of Concerns

Concern 1: Compute Provisioning

Both tracks share identical provisioning foundations. We use Terraform to provision cloud compute droplets/instances on DigitalOcean or AWS, configure SSH keys, and create private VPC networking. Because compute is decoupled from the runtime, you can swap providers without altering your application stacks.

Concern 2: OS & Host Hardening

A cluster is only as secure as the underlying operating system.

  • In Docker Swarm, Ansible ensures Docker packages and dependencies are installed with standard security defaults.
  • In Dark K3s, Ansible runs the k3s_os_hardening role first. It configures UFW to drop all incoming packets by default, isolates port 6443 strictly to internal network interfaces, and ensures no administrative ports are exposed publicly.

Concern 3: Orchestration Runtime

  • Docker Swarm is ideal for small, resource-constrained environments (1–2 vCPUs, 1GB RAM). It is built directly into Docker, uses Raft consensus for managers, and provides zero-overhead container clustering.
  • K3s delivers a fully compliant CNCF Kubernetes control plane packaged as a single ~100MB binary. It provides access to the vast Kubernetes ecosystem (CRDs, Operators, Helm charts) while binding loopback (127.0.0.1) to prevent external exposure.

Concern 4: Cluster Operations & Delivery (Portainer vs. FluxCD)

Notice the deliberate operational mirroring:

  • In Docker Swarm, cluster management is handled visually by Portainer. Operators deploy and monitor application stacks via a clean web UI, inspecting container logs and resource usage.
  • In Kubernetes, cluster delivery is handled declaratively by FluxCD Operator. Instead of manual UI deployments, Flux pulls versioned, signed OCI artifacts from GHCR and continuously reconciles desired cluster state.

Concern 5: Ingress & Perimeter Defense (Caddy vs. OpenZiti)

How external traffic reaches workloads represents the largest architectural divergence:

  • Traditional Edge Ingress (Caddy): Swarm uses Caddy to listen on public ports 80 and 443. Caddy automatically negotiates Let’s Encrypt certificates, reverse-proxies requests to backend Swarm overlay networks, and secures endpoints using OAuth/GitHub authentication.
  • Zero-Trust Dark Mesh (OpenZiti): In K3s, we go one step further. Inbound port 6443 is completely closed to the internet. Traffic reaches workloads and the control plane exclusively through an encrypted, identity-authenticated OpenZiti overlay network. Public scanners cannot probe or exploit the API server because it does not listen on any public port.

Concern 6: Secrets & Configuration Layering

Hardcoded secrets in Git repositories are the number one source of infrastructure compromise:

  • Both tracks retrieve sensitive tokens at deploy time using the 1Password CLI (op) via Ansible lookup plugins.
  • In K3s, configuration layering follows a strict rule: never hardcode spec.values in HelmRelease. Instead, default values ConfigMaps are combined with cluster override ConfigMaps using reconcile.fluxcd.io/watch: Enabled, ensuring immediate reconciliation when configurations change.

Next Steps

To explore how these concerns are implemented in code: