A production Kubernetes platform for a research lab
Our lab runs its own infrastructure: file sharing, source control, single sign-on, teaching tools, a shared pool of GPUs for experiments, and language models that never leave the building. All of it lives on one self-hosted Kubernetes cluster. This post walks through how the platform is put together and why, one layer at a time.
At a glance
Area | What we run |
|---|---|
Cluster | k3s (Kubernetes 1.34): 3 control-plane VMs, 7 worker VMs, 10 bare-metal GPU nodes |
Virtualisation | 3 Proxmox hosts, one control-plane VM on each |
Delivery | Argo CD, about 65 applications, one Git repository |
Edge | Traefik ×3 behind MetalLB, wildcard TLS from cert-manager, SSO with Authentik |
Storage | Longhorn volumes, CloudNativePG for Postgres, a ZFS file server with NFS and S3 |
GPUs | 11 cards from 8 GB to 80 GB, scheduled by SkyPilot and Kueue |
Local AI | Four model servers sharing one H100 |
The whole platform on one page. The highlighted boxes are the parts this post spends the most time on.
1. Foundation: k3s on Proxmox, GPUs on bare metal
The general-purpose nodes are virtual machines on three Proxmox hosts. The GPU machines join the same cluster as bare-metal agents, with a taint so that only GPU workloads land on them.
The control plane is three VMs with embedded etcd, one per hypervisor, so losing a host never costs quorum. A virtual IP managed by kube-vip fronts the API server. MetalLB hands out service addresses in layer-2 mode. There is no cloud load balancer anywhere in the design.
2. Everything goes through Git
A single Argo CD root application discovers every application definition in the repository. Almost all of them sync automatically and self-heal, so the cluster converges on what is in Git and manual drift gets reverted.
A few deliberate exceptions exist. Pruning is off for storage, monitoring and the password manager, because a rendering mistake there must never be able to delete volumes.
Secrets are committed too, encrypted with Sealed Secrets. Only the controller inside the cluster can decrypt them, and its key has its own encrypted off-cluster backup.
Updates are automated but not blind. Renovate runs every weekday and opens merge requests for new chart and image versions. Patch and minor updates merge on their own after a three-day soak. Major versions, databases and critical applications wait for a person, and each of those opens a helpdesk ticket so it cannot be forgotten.
Changes reach the cluster only through Git. Renovate proposes updates, and risky ones are routed to a human.
3. The edge: one proxy, two front doors
Traefik runs as three replicas on separate nodes with a disruption budget. It exposes two sets of entrypoints on two virtual IPs:
- Public: the firewall forwards one public address to this IP.
- Internal: the firewall never forwards to this IP, so it is reachable only from the lab network and the VPN.
Admin interfaces (cluster management, hypervisors, dashboards) attach only to the internal entrypoints. Their access control is network topology, not an allowlist that someone has to keep up to date. The same proxy also fronts a handful of services outside Kubernetes, so they get the same TLS and routing as everything else.
TLS. cert-manager owns every certificate, including a wildcard for the lab domain. A wildcard needs a DNS-01 challenge, but our parent DNS zone is operated by the university and offers no API. We delegated one small challenge subdomain to an acme-dns instance in the cluster, and cert-manager answers challenges there. No credentials for the real zone exist anywhere.
Identity. Authentik is the identity provider. Eleven applications log in through OIDC, including Argo CD, the cluster console, the VPN, the experiment tracker and the GPU scheduler. Applications without native SSO sit behind a forward-auth middleware in Traefik.
4. Split-horizon DNS that maintains itself
The same hostname has to work from the internet, from the office and from the VPN. Outside clients must arrive at the public address. Inside clients should go straight to the proxy, and should also be able to reach internal-only services.
Same hostname, different answer. External traffic passes the firewall's NAT. Internal and VPN traffic goes directly to the proxy, and only it can reach the internal entrypoint.
Nobody edits internal DNS records by hand. A route declares which entrypoint it uses, and everything else follows:
- A Kyverno policy reads the entrypoint and stamps the matching virtual IP onto the route as its DNS target.
- external-dns watches the routes and sends signed dynamic updates to a BIND primary. The signing key is only allowed to change address records.
- A pair of CoreDNS resolvers serves an in-memory copy of that zone. If BIND is down, updates pause, but resolution keeps working.
- Names that are not in the zone fall through to the upstream resolvers, so everything else on the internet resolves as usual.
Cluster DNS forwards the lab domain to the same resolvers, so pods get the same answers as laptops.
Internal DNS records are derived from the routes in Git. Publishing a service and making it resolvable are the same commit.
5. Remote access
Remote access uses a self-hosted Headscale control server with its own relay, so no third party is involved in the VPN. Users sign in through the same SSO. The access rules are default-deny: regular members reach only the two proxy addresses and the resolver, and administrators additionally reach the server networks. Two subnet routers run in the cluster for redundancy. Split DNS sends only the lab domain to the internal resolvers and leaves the rest of the user's DNS alone.
6. Storage and backups
Three kinds of data get three kinds of storage:
- Block volumes: Longhorn replicates volumes across the seven worker VMs. GPU nodes hold no replicas, because they reboot for driver and kernel updates.
- Databases: CloudNativePG runs five PostgreSQL clusters with three instances each, plus nightly logical dumps.
- Files and objects: a ZFS file server (raidz2) provides NFS for research data and an S3-compatible store for etcd snapshots, logs, experiment artifacts and CI caches.
Every stateful component has a scheduled copy on the file server, and the file server is copied offsite every night.
Volumes are backed up daily, etcd is snapshotted every twelve hours, and the file server replicates offsite nightly. We have restored a production database volume from these backups into a Git-managed claim, so the restore path is proven and written down.
7. Guardrails and observability
- Pod Security enforces the baseline profile cluster-wide. Every exempt namespace has a documented reason.
- Admission policies fail open. If the policy engine is down, deployments continue. A helper must never become a single point of failure.
- Network policies fence off anything that runs untrusted code: CI jobs, GPU jobs and the model servers.
- Access logs drop request headers, so cookies and tokens never reach the log store.
Prometheus and Grafana cover metrics, including per-GPU telemetry. Loki keeps 30 days of logs in object storage. Alerts go from Alertmanager into the team chat. Some alerts are our own, such as one for slow etcd writes, which is the earliest warning sign this cluster has.
8. GPU experiments: SkyPilot on top of Kueue
The GPU pool is ten very different machines, from an RTX 2060 to an RTX 4090 and an H100. Researchers do not pick a machine. They describe a job and submit it:
resources:
accelerators: MIN-12GB
run: python train.pysky jobs launch job.ymlA job asks for a memory class, not a machine. Kueue decides when it runs and on which card.
Classes instead of models. A job requests "at least 12 GB", not a specific card. Kueue tries the weakest fitting GPU first, so small jobs do not occupy the large cards.
An admin policy in the SkyPilot API server rewrites every request. It maps the request to a class, puts the job into a personal queue, blocks the GPU reserved for model serving, and by default shuts down interactive sessions after 24 idle hours.
Fair sharing. Kueue orders the queue by recent GPU usage with a 24-hour half-life. Someone who has just used a lot of GPU time queues behind someone who has not. A priority class can preempt running jobs for deadlines.
Sandboxed jobs. Job pods carry no cluster credentials and can reach only each other, DNS, the experiment tracker and the internet. They get shared datasets, per-user scratch space and package caches over NFS, and they log to MLflow.
Scheduling is scoped to one namespace, so a scheduler problem cannot affect the rest of the cluster.
9. Local AI on a single H100
One H100 with 80 GB is kept out of the batch queue and serves models instead. The GPU is time-sliced into four slots, each used by one inference server:
- a general chat model with tool calling (SGLang)
- a small, fast model for routing and classification (llama.cpp)
- an embedding model (llama.cpp)
- an image model (SGLang)
One GPU, four model servers. Clients talk only to the router, which handles login and picks the backend.
In front of them sits a router application we built ourselves, with SSO login. A network policy closes the namespace to the rest of the cluster, so clients reach the models through the router. Prompts and documents stay on our own hardware.
10. What production taught us
- etcd is the first thing to hurt. Control-plane VMs on spinning disks produce slow-write warnings long before anything breaks, so we alert on them and check etcd health before every bulk change. After a single uplink failure threatened quorum, each control-plane VM now lives on a different host.
- Know which redundancy you have. With layer-2 load balancing, three proxy replicas give failover, not load spreading. That is fine, as long as nobody plans capacity on the wrong assumption.
- GPUs fail quietly. One card passed normal jobs but returned wrong results under load. We now run a verification job before a node enters the pool: it fills the memory with known patterns and repeats a reference computation while logging power and temperature. It identified that card as faulty, and showed that another one is stable only under a power cap.
- Keep the blast radius small. Fail-open webhooks, no pruning for stateful systems, and a scheduler limited to one namespace all come from the same rule: an optional component must not take down a required one.
Closing
None of the individual parts is unusual. What makes the platform production-grade is how they fit together: every change is a commit, DNS and certificates follow from routes, each kind of state has a tested backup, and the shared GPUs are scheduled by policy instead of by negotiation. That lets a small team run about 65 applications and a GPU cluster without the platform becoming the bottleneck.