Architecture
How CosmicAC's components fit together and connect to your Kubernetes cluster.
CosmicAC is a self-hosted platform that runs GPU workloads on your Kubernetes cluster. Its components run outside the cluster and reach it through the Kubernetes API, so you keep operating the cluster while CosmicAC runs workloads on it.
For how each job type runs, see GPU Container architecture and Managed Inference architecture. For deployment steps, see Installation.
Deployment architecture
Setting up your cluster is separate from deploying CosmicAC. You bring a Kubernetes cluster that already has its GPU nodes and KubeVirt configured. The CosmicAC components then connect to that cluster and run your workloads on it.
CosmicAC provisions a GPU virtual machine instance (VMI), a KubeVirt resource, for every workload. The Containerized Data Importer (CDI) imports the VMI root disk from a registry image. The VMI claims one or more whole GPUs through PCI passthrough, and a multi-node workload also claims InfiniBand.
Your cluster's requirements fall into two tiers.
- Base platform: the Kubernetes, GPU, virtualization, storage, and registry foundation that every workload needs.
- Overlay networking: an add-on tier that connects a workload's nodes over an OVS/VXLAN subcluster, and provides a WireGuard gateway for workloads that need an isolated network.
A multi-node vLLM Managed Inference replica needs the subcluster. See Requirements.
The following diagram shows the Kubernetes resources that cosmicac-wrk-server-k8s-nvidia creates for a job, how the VMI claims its GPUs, and where the overlay network attaches.
Racks, nodes, and GPUs
Your GPU capacity has three nested levels.
- Rack: the GPU capacity behind one worker, listed under a single location. Despite the name, a rack is an entry in your CosmicAC network, not physical hardware. The worker reports the nodes and GPUs of the cluster it connects to, and cosmicac-wrk-ork tracks them as available capacity.
- Node: a machine in your cluster that holds a pool of GPUs. More than one job can run on the same node, each claiming different GPUs from its pool.
- GPU: a single accelerator card, such as an H100. A job claims one or more whole GPUs through passthrough.
A default deployment registers one rack during task bootstrap. To register, list, or remove racks yourself, see Manage racks in your CosmicAC network.
When you create a job, CosmicAC finds a rack in the location you chose, then reserves GPUs on nodes in that rack. Every VMI runs inside a Kubernetes pod on a node. Because a node holds a pool of GPUs, one node can host many jobs at once, each in its own pod.
For a Managed Inference Job, the replica GPU count determines how many nodes it takes.
- Single node: the replica's GPU count fits one node, so it runs in a single VMI.
- Multi-node: the replica's GPU count is more than one node holds, so it runs one VMI on each node.
Only a vLLM Managed Inference replica can be multi-node. It takes its nodes from one rack, and each of those nodes contributes the same number of GPUs. CosmicAC joins the replica's VMIs over InfiniBand and an overlay network.
Every other job runs on one node. If you request more GPUs for a GPU Container Job than a node holds, CosmicAC fails the job.
CosmicAC components
Most CosmicAC components run on your host machine, outside your Kubernetes cluster. The CLI runs on your workstation, and the per-job agents run inside each job's VMI.
| Component | Runs on | What it does |
|---|---|---|
| cosmicac-ui | Host machine | Web interface that provides a browser dashboard for creating and managing jobs. |
| cosmicac-cli | Your workstation | Command-line interface that submits jobs, manages resources, and connects to containers from your terminal. |
| cosmicac-app-node | Host machine | App server that serves the HTTP API, authenticates requests, and routes commands to the orchestrator. |
| cosmicac-wrk-ork | Host machine | Orchestrator that allocates resources, distributes jobs across the cluster, and routes requests to the workers. |
| cosmicac-wrk-server-k8s-nvidia | Host machine | Server worker that connects to your cluster's Kubernetes API and provisions the VMIs. |
| cosmicac-proxy-inference | Host machine | Inference proxy that authenticates Managed Inference requests, balances load, and routes them to model servers. |
| cosmicac-wrk-agent-instance | Job VMI | Per-job agent that runs inside a GPU Container Job's VMI and accepts shell sessions over hyperswarm-ssh. |
| cosmicac-wrk-agent-inference | Job VMI | Per-job agent that serves the model with the job's vLLM or Parakeet runtime, and registers itself in the DHT table. |
| cosmicac-wrk-monitor | Host machine | Observability aggregator that collects logs and metrics from the other services, exposes them for your Prometheus to scrape, and pushes log lines to your Loki. |
| redis | Host machine | In-memory data store that cosmicac-app-node uses for caching and runtime state, with persistence enabled. |
| caddy | Host machine | Web entry point that serves the UI and reverse-proxies API, inference, and monitor traffic on port 5173. |
Caddy proxies /api to cosmicac-app-node, /inference to cosmicac-proxy-inference, and /monitor to cosmicac-wrk-monitor. Every other path serves the web interface.
Holepunch stack
Inside CosmicAC, the components connect to each other over the Holepunch peer-to-peer stack rather than through a central server. Components address each other directly, so there is no central broker to route, bottleneck, or expose internal traffic.
| Technology | Used by | What it carries |
|---|---|---|
| Hyperswarm | Every component | Peer discovery and direct connections, without a central broker. |
| hyperswarm-rpc | cosmicac-app-node, cosmicac-wrk-ork, and the workers | Internal RPC calls along the control path. |
| hyperswarm-ssh | cosmicac-cli and cosmicac-wrk-agent-instance | Shell sessions into a running GPU Container Job. |
| HRPC + Hyperswarm | cosmicac-proxy-inference and cosmicac-wrk-agent-inference | Streamed inference responses from the models. |
| DHT table | cosmicac-wrk-agent-inference registers, cosmicac-proxy-inference discovers | Model server locations, looked up by topic. |
| HyperDB + Autobase | cosmicac-app-node | Usage metrics and job metadata. |