socialweb.computer

Request and provide VMs on an atproto compute market.

GitLab on a Tenant Cluster

This guide covers connecting a GitLab runner to a tenant cluster, which is a virtual k3s cluster provisioned by a socialweb-computer gateway with guest VM nodes rented from the compute market. The GitLab server and runner run on the kcp host, and jobs run as Pods on the tenant cluster.

The guide has three steps, each in its own document:

StepDocumentWhat it covers
1The kcp serverInstall the gateway, create the tenant cluster, size the nodes, mint the runner's credential, grant its group
2The GitLab runnerInstall GitLab, register a runner, write its config.toml, start it
3JobsJob images, pipelines, one job per node, scaling, the cross-node limit

Step 1 produces a cluster URL, three credential files, and a group name. Step 2 points a runner at them, and Step 3 covers what happens when a job runs. If the cluster was created by a user through the gateway instead of on the operator's host, see 04.

Contents

Apiserver Reachability

A tenant apiserver only binds to loopback on the kcp host. It doesn't listen on a network interface, and no configuration changes that. Two routes reach it, and they aren't interchangeable:

RouteURLCredential that works
Direct, host-localhttps://127.0.0.1:<k3s-secure port>Client certificate signed by that cluster's ClientCA
Through the kcp mounthttps://<kcp-host>/clusters/root:<accountHash>:<cluster>:clustersBearer token only

The mount is a reverse proxy where kcp terminates TLS and forwards traffic to the apiserver, so a bearer credential passes through while a client certificate doesn't. That works for a human running kubectl with a minted token, but it doesn't work for GitLab CI, which needs Kubernetes exec and attach paths (pods/exec) over an upgraded SPDY connection that a reverse proxy doesn't carry.

That limit only applies to a kcp host's bearer-only mount. The kubeconfig issued by the gateway (getKubeconfig, v0.0.4 and later) goes through the client certificate front and carries pods/exec, logs, attach, and port-forward. A runner using that kubeconfig ran a job on 2026-11-25 (04).

Run the GitLab Runner on the kcp host so it can reach 127.0.0.1:<port>. Each cluster gets a leased port instead of a fixed one, so read it from the cluster status:

kubectl --kubeconfig <admin> get cluster <name> -o jsonpath='{.status.url}'

Use the returned URL for host in the runner config.

GitLab on a Separate Host

GitLab on another host can't reach a loopback-bound apiserver, and no runner setting fixes that. Supporting it would mean publishing an authenticated front for the apiserver on the kcp host, which widens a trust boundary kept at loopback on purpose. internal/gatewaymain/config.go refuses to bind anything except loopback, and the host's caddy config (scripts/deploy.sh) publishes only the gateway API and the kcp front. See 01.

Cross-Node Traffic and DNS

Each market node resolves names through its own node-local CoreDNS, and pods reach pods on other nodes over socialweb-meshd. That cross-node path is the newest and least proven part of a market cluster. Read 03 before scaling past one node for workloads that need the network.

Node Count and Idle Hold

The default node ceiling is ten (values below one are refused instead of clamped), and SOCIALWEB_CLUSTERPROVIDER_SCALE_PODS_PER_NODE defaults to 8. Since every node is a booted guest, both settings control cost. Set podsPerNode from a measured job, though with pod anti-affinity one job Pod occupies one node regardless of that setting.

When the node ceiling is above one, set the runner's concurrent setting above one as well. Leaving it at 1 means a leftover job from a cancelled pipeline will hold the only slot.

Once a cluster sits idle past the grace period (SOCIALWEB_CLUSTERPROVIDER_SCALE_HOLD, default 2m), it drops to zero nodes, so the next job pays the node boot time again. GitLab's pre-warmed pause pods (03) exist to hide that latency.