Network Architecture

MEGATRON uses a layered networking architecture combining Cloudflare tunnels for public ingress, Tailscale for private mesh networking, and Traefik for Kubernetes-level routing.

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                        INTERNET                                  │
└──────────────────────────┬──────────────────────────────────────┘
                           │
                           v
┌─────────────────────────────────────────────────────────────────┐
│                   CLOUDFLARE (DNS + WAF)                         │
│                                                                  │
│  Domains: stiq.us, corestation.io, idp.pro,                     │
│           kelseyfarmequipment.com, m3gatr0n.com                  │
│                                                                  │
│  Tunnel: 6d8885c4-97d9-43fd-8426-78a00c2834f1                   │
│  Routes: 49 hostname-based rules                                 │
│  Pattern: hostname -> https://localhost:32672 (noTLSVerify)      │
└──────────────────────────┬──────────────────────────────────────┘
                           │
                           v
┌─────────────────────────────────────────────────────────────────┐
│                   MEGATRON (Host)                                 │
│                                                                  │
│  cloudflared ──────> localhost:32672                              │
│                           │                                      │
│                           v                                      │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │              Traefik Ingress Controller                     │  │
│  │              (kube-system, NodePort :32672)                 │  │
│  │                                                            │  │
│  │  Host-based routing:                                       │  │
│  │  *.stiq.us ──────────────> stiq / stiq-dev / stiq-staging  │  │
│  │  *.corestation.io ───────> corestation / *-dev / *-staging │  │
│  │  *.idp.pro ──────────────> idp / idp-dev                   │  │
│  │  *.m3gatr0n.com ─────────> glamhub, auth, monitoring, etc  │  │
│  │  kelseyfarmequipment.com > kelsey                          │  │
│  └────────────────────────────────────────────────────────────┘  │
│                           │                                      │
│                           v                                      │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │              K3s Pod Network (ClusterIP services)           │  │
│  │              Linkerd Service Mesh (mTLS)                    │  │
│  └────────────────────────────────────────────────────────────┘  │
│                                                                  │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │              Tailscale Mesh (WireGuard)                     │  │
│  │  megatron: 100.70.25.47                                    │  │
│  │  mac-studio: 100.87.201.64                                 │  │
│  │  macbook-m4: 100.91.253.88                                 │  │
│  │  lambda: 100.108.49.109                                    │  │
│  └────────────────────────────────────────────────────────────┘  │
│                                                                  │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │              Docker Bridge Network                          │  │
│  │  Bibliotheca containers, Coolify                            │  │
│  │  localhost:8080 (qBittorrent), :8088 (nginx), :8000        │  │
│  └────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────┘

Port Map

External Ports (Internet-facing via Cloudflare)

All public traffic enters through the Cloudflare tunnel -- no ports are directly exposed to the internet.

Host Ports

PortServiceProtocolAccess
22SSH (normal)TCPLAN / Tailscale
2222SSH (rescue, high priority)TCPLAN / Tailscale
2223Forgejo SSH (Git)TCPLAN / Tailscale
6443K3s API serverTCPLAN / Tailscale
8000CoolifyTCPlocalhost
8080qBittorrent (Bibliotheca)TCPlocalhost
8088Bibliotheca nginxTCPlocalhost
7700MeilisearchTCPlocalhost
11434OllamaTCPClusterIP / localhost
32672Traefik NodePort (HTTPS)TCPlocalhost (cloudflared)
3307MariaDB (Coolify)TCPlocalhost
6380Redis (Coolify)TCPlocalhost

Kubernetes Service Ports (ClusterIP, internal only)

ServicePortNamespace
Traefik80, 443kube-system
CoreDNS53kube-system
Prometheus9090monitoring
Grafana3000monitoring
Loki3100monitoring
AlertManager9093monitoring
Vault8200vault
Harbor443registry

Network Layers

Layer 1: Cloudflare (Public Ingress)

All public traffic flows through Cloudflare, which provides DNS, DDoS protection, WAF, and the tunnel endpoint. See Cloudflare Tunnels.

Layer 2: Traefik (Kubernetes Ingress)

Traefik receives tunnel traffic on NodePort 32672 and routes based on hostname to the appropriate Kubernetes service. See Traefik Ingress.

Layer 3: Linkerd (Service Mesh)

Linkerd provides mutual TLS between pods, traffic metrics, and reliability features. See Linkerd.

Layer 4: Tailscale (Private Mesh)

Tailscale connects MEGATRON to other machines (Mac Studio, MacBook, Lambda) via WireGuard-based mesh VPN. See Tailscale.

Layer 5: Docker Bridge (Container Networking)

Non-K3s containers (Bibliotheca, Coolify) use Docker bridge networking with port mappings to localhost.

DNS Flow

User browser
    │
    v
DNS query: app.stiq.us
    │
    v
Cloudflare DNS ──> resolves to Cloudflare edge
    │
    v
Cloudflare tunnel routes to MEGATRON
    │
    v
cloudflared ──> https://localhost:32672
    │
    v
Traefik matches Host header ──> routes to K3s service
    │
    v
K3s service ──> Pod (via kube-proxy/iptables)

Key Networking Issues

  1. cert-manager HTTP-01 broken -- Cannot complete ACME challenges behind Cloudflare tunnel. Must migrate to DNS-01 solver.
  2. Harbor TLS NOT READY (20 days) -- Certificate pending due to HTTP-01 failure.
  3. Devtron TLS NOT READY (20 days) -- Same root cause.
  4. Monitoring wildcard cert NOT READY -- Same root cause.

See TLS Certificates for full details.