Kubernetes architecture¶
All Patina Network self-owned infra runs on a single AKS cluster.
Changes are tracked in a IaC repo under Patina-Network/k8s-manifests.
Who owns what¶
| Layer | Owned by |
|---|---|
| AKS cluster, node pools, public IP, Azure RBAC, DNS | platform-infra (Pulumi) |
| Everything running inside the cluster (services, dbs) | k8s-manifests (Flux) |
Node pools¶
| Pool | Runs | Notes |
|---|---|---|
syspoolv3 |
kube-system, infrastructure + shared infra |
x86 VM |
prodpoolv1 |
production |
burstable ARM VM |
stgpoolv1 |
staging |
spot ARM VM; spot = Azure can remove it at any time due to unavailability or shortages |
Each environment more or less gets it's own VM so that resource spikes in any likely won't affect others.
Networking¶
There are two Traefik ingress controllers, and which one an app routes through decides who can reach it.
Internet Tailnet (VPN)
| |
public IP (LoadBalancer) vpn-traefik (tailscale sidecar)
| |
Traefik web / websecure web-vpn / websecure-vpn / postgres / redis / grpc
| |
codebloom, patchats, docs, every staging app, grafana, pkg (artifact-keeper),
gerrit, headscale db (postgres), redis, internal prod services
- Public:
<app>.patinanetwork.org. Traefik is aLoadBalancerservice pinned to thetraefik-public-ipmanaged byplatform-infra. - VPN-only:
<app>.vpn.patinanetwork.org(staging usesstg.<app>.vpn.patinanetwork.org).vpn-traefikhas no public address; a Tailscale sidecar joins it to the Headscale tailnet, andvpn-corednsresolves every*.vpn.patinanetwork.orgname to it for connected clients. See How to connect to VPN. - TLS: public certs use HTTP-01 challenges; VPN certs use DNS-01 challenges (since Let's Encrypt can't reach VPN hosts).
- Auth: Headscale logins and the
azure-oidcmiddleware (e.g. in front ofdocs) both use Patina Network's Azure (Entra ID) tenant. - NetworkPolicy: the cluster runs Azure CNI Overlay with the Cilium data
plane, which enforces
NetworkPolicy(aka what pods can talk to what).
Sample request¶
flowchart TD
A["Browser makes call to codebloom.patinanetwork.org"] --> B["DNS lookup for codebloom.patinanetwork.org -> Azure Public IP (stored in DigitalOcean)"]
B --> C["Azure Load Balancer (aka L4 Load Balancer)"]
C --> D["Traefik Reverse Proxy/Load Balancer in K8s cluster (aka L7 Load Balancer)"]
D --> E["Traefik Pod does some stuff to request (e.g. https:// means we check SSL and then convert it to http:// for rest of chain)"]
E --> F{"IngressRoute matches Host + Path written for Codebloom"}
F -->|"/actuator/*"| G["basic-auth middleware"]
F -->|"/actuator/health/*"| I
F -->|"/ (everything else)"| H["basic-rate-limit middleware (100 req/s)"]
G --> I["codebloom Service object<br/>(ClusterIP, defines port mapping from 80 -> 8080)"]
H --> I
I --> J["codebloom Pod<br/>container listening on :8080"]