Skip to main content

Verify in your own Kubernetes cluster

Install the SchemaBounce runner chart in your cluster to verify services only your network reaches: a private cluster, a home lab or on-premises over Tailscale or a VPN. Every value, every refusal.

A service that only your network reaches (a private cluster, a home lab, an on-premises stage, a host behind a VPN or Tailscale) is verified by a runner that runs in that network. In Kubernetes, you install the runner chart. For each verify round the runner makes a short-lived, locked-down pod and deletes it afterwards.

Why it matters: hosted verify reaches public HTTPS hosts only (dec-080). This is the supported way to verify everything else, and it keeps your repository's commands inside your own cluster.

The runner dials out to SchemaBounce. Nothing connects in. This chart is a runner, not a self-hosted SchemaBounce platform (dec-291, dec-325).

What you need​

  • A Kubernetes cluster whose network plugin enforces NetworkPolicy. The runner proves it (see The deny canary).
  • A namespace that enforces the restricted Pod Security level. Baseline is refused.
  • Your cluster's service address range (serviceCidr).
  • The addresses of the SchemaBounce API and of your Kubernetes API server, for the runner's own network policy.
  • A service on an Environment whose reach is runner:<label>.
  • Helm 3.

The chart lives in the core-api repository at code-sandbox-runner/deploy/runner-chart. SchemaBounce does not publish it to a chart registry yet, so install it from a checkout of that path.

Install​

1. Make the namespace​

Use a namespace for the runner alone. The runner's Role can delete Secrets in it.

kubectl create namespace sb-runner
kubectl label namespace sb-runner \
pod-security.kubernetes.io/enforce=restricted --overwrite

The chart can create and label the namespace if you set createNamespace=true. Creating it yourself, as above, avoids a clash with helm install --create-namespace.

2. Get an enrollment token​

In the console open Code > Runners > Add runner and copy the one-time enrollment token. Put it in a Secret. The key is token:

kubectl -n sb-runner create secret generic sb-runner-enrollment \
--from-literal=token='<enrollment token>'

The runner exchanges the token for a session token and keeps that on its own volume, so a restart does not need a new one.

3. Find the three network values​

# serviceCidr: the cluster's service range. The error text names the valid range.
kubectl create service clusterip probe --clusterip=1.1.1.1 --dry-run=server -o name

# egress.kubeApi.cidrs: the API server's own addresses
kubectl get endpoints kubernetes -n default

# egress.coreApi.cidrs: the addresses behind your coreApiUrl host
dig +short api.schemabounce.com

A NetworkPolicy cannot name a host, only addresses, so the runner's own policy lists them. If SchemaBounce's API addresses change, update egress.coreApi.cidrs and run helm upgrade. Symptom of a stale list: the runner cannot reach the API and stops claiming work.

4. Install​

helm install sb-runner ./code-sandbox-runner/deploy/runner-chart \
--namespace sb-runner \
--set coreApiUrl=https://api.schemabounce.com \
--set image.digest=sha256:<pinned digest> \
--set image.repository=ghcr.io/schemabounce/core-api/code-sandbox \
--set enrollmentToken.existingSecret=sb-runner-enrollment \
--set serviceCidr=10.96.0.0/12 \
--set 'egress.coreApi.cidrs={203.0.113.10/32}' \
--set 'egress.kubeApi.cidrs={192.168.49.2/32}' \
--set deployVerify.enabled=true

If your cluster cannot pull from ghcr.io, mirror the image into your own registry, set image.repository to the mirror and set imagePullSecretName.

The chart refuses to render without coreApiUrl, enrollmentToken.existingSecret, image.tag or image.digest, serviceCidr, egress.coreApi.cidrs and egress.kubeApi.cidrs.

5. Label the runner​

On Code > Runners, give the runner a label such as dev-cluster. A service with reach: runner:dev-cluster is verified by this runner. The label is lowercase letters, digits and dashes, 63 characters at most.

6. Point a service at it​

On the Environment's Services tab choose A runner (private hosts allowed) under "Where verify reaches it", type the runner name, and set the Address to the private URL (HTTP or HTTPS):

{
"name": "web",
"repository": "acme/web",
"baseUrl": "http://10.20.0.15:8080",
"versionCheck": { "http": { "path": "/.well-known/schemabounce/version", "json": "commit" } },
"reach": "runner:dev-cluster"
}

Then check the runner logged deploy verify is on in Kubernetes mode.

Every chart value​

ValueDefaultMeaning
image.repositoryghcr.io/schemabounce/core-api/code-sandboxThe code-sandbox image. The runner and every round pod use it.
image.tagemptyImage tag. One of tag or digest is required.
image.digestemptyPin a digest. Wins over the tag.
image.pullPolicyIfNotPresentPull policy.
imagePullSecretNameemptyAn image pull Secret, for the runner and its pods.
coreApiUrlempty, requiredThe SchemaBounce API, https, no trailing slash.
enrollmentToken.existingSecretempty, requiredName of your Secret holding the enrollment token.
enrollmentToken.keytokenThe key in that Secret.
persistence.size64MiThe volume that keeps the runner's session token.
persistence.storageClassNameemptyStorage class for that volume.
deployVerify.enabledfalseYour opt-in. Without it the runner claims no verify work.
deployVerify.allowedHosts[]Hosts a round and a version check may touch.
deployVerify.restrictHoststrueWhen true the list is written, and an empty list allows no host. When false the list is omitted and any host is allowed.
egress.coreApi.cidrs[], requiredAddresses of the SchemaBounce API, for the runner's own policy.
egress.coreApi.port443Port on those addresses.
egress.kubeApi.cidrs[], requiredAddresses of your Kubernetes API server.
egress.kubeApi.port443Port on those addresses. Some clusters use 6443.
egress.serviceHosts.cidrs[]Addresses of the services the runner reads versions from. See Deploy observation.
egress.serviceHosts.ports[443]Ports on those addresses. Must list at least one port when cidrs is set.
dns.namespacekube-systemNamespace of cluster DNS.
dns.podLabelKey and dns.podLabelValuek8s-app, kube-dnsLabels of the DNS pods.
canaryEvery20Re-prove NetworkPolicy enforcement every N rounds, and hourly.
createNamespacefalseCreate and label the namespace.
serviceCidrempty, requiredThe cluster's service range. A round reaches it only for a host allowedHosts names, as that exact address. A string, or a list for a dual-stack cluster ({10.96.0.0/12,fd00:10:96::/112}). Every entry must be a valid CIDR.
apiServerCidremptyOptional extra addresses of the API server. Same format.
forwarderPort18088Where round pods reach the runner's forwarder.
resources50m / 64Mi requests, 250m / 256Mi limitsThe runner's own container.

What the chart installs​

  • A Deployment of one runner (replicas: 1, strategy Recreate), non-root (uid 1010), read-only root filesystem, every capability dropped, seccomp RuntimeDefault. It starts with --verify-isolation=kubernetes. The runner holds one round at a time.
  • A ConfigMap with runner.toml: your opt-in and host list. The server never sends either.
  • A volume for the runner's session token.
  • A NetworkPolicy for the runner: egress to cluster DNS, to the SchemaBounce API addresses and to the Kubernetes API addresses, nothing else. Ingress only from verify round pods, only on the forwarder port.
  • A ServiceAccount and Role for the runner (below), and a second ServiceAccount for round pods with no rights and no token.

What the runner's ServiceAccount can do​

A Role in its own namespace, nothing cluster-wide:

ResourceVerbs
podscreate, get, delete, deletecollection
secretscreate, delete, deletecollection
networkpoliciescreate, get, update, delete, deletecollection

There is no list, get or watch on Secrets, so the runner cannot read one back, and no pods/log or pods/exec. Deleting a Secret by deletecollection returns the deleted object, so the runner can see a round's Secret at the moment it deletes it. That Secret is its own, and it is why the namespace should hold nothing else.

What a round is​

For each round the runner creates three things, and deletes them on every path:

  1. A NetworkPolicy, created before the pod. It allows cluster DNS, the runner's forwarder, and the round's service hosts as the addresses DNS returned when the round started, on their ports. Nothing else. A host that moves to another address mid-round is denied.
  2. A Secret for the round, owned by the pod so it is deleted with it. It holds the round bearer and the secrets the steps name.
  3. A pod of two containers, the same pod the hosted verify Job uses:
    • The runner container (uid 1003) mounts the Secret as read-only files, fetches the landed tree, drives the steps, reads the running version and submits the masked result.
    • The executor container (uid 1004) mounts no Secret and runs the repository's commands.

The runner keeps no secret between rounds: the secrets sit in its memory from acknowledgement until the Secret exists, then the map is emptied.

The forwarder is the pod's only way home​

A round pod does not reach the SchemaBounce API directly. The executor shares the pod's network, and the API's addresses sit behind a CDN that fronts many sites, so opening them would open every site behind it. The pod reaches the runner's forwarder instead. The forwarder takes three paths for rounds it holds right now (the source, the running version, the result), accepts only that round's bearer, and adds the runner's own session token itself. The pod holds the bearer only.

What a round can reach​

Only the round's service hosts, as the addresses DNS returned. These are refused:

  • The Kubernetes API server, always. Named in allowedHosts or not.
  • An address in the service range, unless allowedHosts names that exact host. A named host that resolves to a ClusterIP (or a *.svc name) is allowed as that one address only. The policy never holds the whole range.
  • Loopback, link-local and cloud metadata addresses, unless allowedHosts names that exact host.

So to verify a service in the same cluster, put its name in deployVerify.allowedHosts (for example web.staging.svc) and use that name as the service's Address. Using the address of its Ingress or LoadBalancer works too and needs no entry.

There is no egress proxy in your cluster. A step that installs packages from a public registry is blocked. Put dependencies in the image, or in a step that needs none.

Gates before work is claimed​

The runner claims no verify work until all four hold. It checks each on its own, and re-checks every canaryEvery rounds and every hour.

  1. deployVerify.enabled=true.
  2. The service range is set.
  3. The namespace is at the restricted Pod Security level. Two server-side dry runs must both be rejected: a privileged hostPath pod, and a plain pod that only the restricted level rejects. Baseline rejects only the first.
  4. The deny canary passes.

The deny canary​

A cluster whose network plugin ignores NetworkPolicy accepts every policy and leaves the round pod open. The canary proves yours enforces them, with three throwaway pods: a target that listens, a control whose policy allows the target (it must connect), and a pod whose policy allows DNS only (it must be blocked). It counts only when the control connected and the other was blocked. A pod that crashed or failed to pull does not count as proof.

Private clusters over Tailscale, a VPN or on-premises​

A home lab or on-premises stage that you reach over Tailscale or a VPN is the runner-in-cluster case. Run the runner chart in the cluster that can reach the service. The runner dials out, so the cluster needs no public address.

  1. Install the chart as above, in a cluster that can route to the service.
  2. Set the service's Address to the address that cluster reaches. For a tailnet host that is the tailnet IP (100.x.y.z), or a name your cluster DNS resolves. Cluster DNS does not resolve MagicDNS names by default. Tailscale addresses are not refused, except 100.100.100.200, a cloud metadata address that only an exact allowedHosts entry unlocks.
  3. The cluster's pods must route to that address. A Tailscale subnet router, the Tailscale Kubernetes operator or a node on the tailnet do that. SchemaBounce does not configure it for you.
  4. Set deployVerify.allowedHosts to the hosts you intend (for example ["100.64.1.20", "app.lab.internal"]) so a repository can never aim a round elsewhere.
  5. Put a reach: runner:<label> on the service.

A runner that lives on a laptop on the same tailnet works too, with the opt-in in its runner.toml. See the laptop setup. A laptop has no isolation between a repository's commands and your files, so prefer the cluster for anything shared.

Deploy observation needs egress to your services​

The runner also answers the version reads that decide when the landed commit is running. It does those from its own pod, not a round pod, and that pod's policy allows only DNS, the SchemaBounce API and the Kubernetes API. Without more, a private service's version cannot be read and the session shows "Deploy not seen in time". List the addresses and ports of your services:

--set 'egress.serviceHosts.cidrs={100.64.1.20/32}' \
--set 'egress.serviceHosts.ports={8080}'

Keep the list to the addresses your services use. The runner still refuses a version check to a host deployVerify.allowedHosts does not name, so this opens the network path and the owner's list still decides. Round pods get their own per-round policy and do not use this value. The ports default to [443]. A chart with cidrs set and an empty ports list refuses to render, because that would allow every port.

Expose a dev host with a Cloudflare Tunnel​

If you would rather not run a runner, you can make a dev host public over HTTPS and let hosted verify reach it. A Cloudflare Tunnel does this without opening an inbound port: cloudflared runs next to your service and dials out to Cloudflare, which serves the public hostname.

  1. Create a tunnel and a public hostname (for example dev.example.com) that points at your service.
  2. Add that host as a service on the Environment with SchemaBounce (public hosts only). The address must be HTTPS and resolve to a public IP.
  3. Keep the version endpoint reachable at its path, with Cache-Control: no-store.

Do not put Cloudflare Access in front of it. A verify round and a browser check cannot present Access credentials, so the service would fail to read. Access-protected environments are not supported yet. Because the host is public, protect anything sensitive in the app itself: sign-in on every route that matters, and no real customer data in a dev stage. A runner keeps the service private, which is the safer choice for anything you would not put on the internet.

What the runner says​

Every refusal has a plain cause. The runner logs the sentence on the left.

It saysWhat to do
Kubernetes verify is off: ...The agent could not start Kubernetes mode. The reason follows. Run it in a cluster with the chart.
deploy verify is not enabled in the runner's local configSet deployVerify.enabled=true and run helm upgrade.
SB_RUNNER_K8S_SERVICE_CIDR is required or the cluster's service range is not setSet serviceCidr. The chart will not render without it.
... has an entry that is not a CIDROne entry in serviceCidr or apiServerCidr is not a valid CIDR.
the namespace accepted the privileged hostPath probe pod or ... the restricted-level probe pod: label it pod-security.kubernetes.io/enforce=restricted (the baseline level is not enough)Label the namespace restricted.
the ... pod-security dry run did not give a clear refusalThe namespace may not enforce Pod Security at all, or the API refused the dry run for another reason. Read the error that follows.
a pod whose policy allows only DNS reached another pod: this cluster's network plugin does not enforce NetworkPolicyYour network plugin ignores policies. Use one that enforces them, or do not use this mode.
the allowed canary connection did not work, so the test proves nothingThe test pods could not connect even when allowed. Check the image pull, DNS and the namespace's ingress rules.
the cluster did not prove it is a safe place for verify pods: ...One of the two proofs above failed. The runner claims no round until it passes.
host X is not in the runner's allowed_hosts; the round was refusedAdd X to deployVerify.allowedHosts. On the session this is "The runner does not allow the service's hosts".
resolve X: no addressCluster DNS cannot resolve X. Use an address or fix DNS.
X resolves to A, the cluster's API server, which a round never reachesUse another address. The API server is always refused.
X resolves to A in the cluster's service range, which a round reaches only for a host that allowed_hosts namesName X in deployVerify.allowedHosts, or use the Ingress, LoadBalancer or node address.
X resolves to A, which a round does not reach (loopback, link-local or metadata) unless allowed_hosts names the hostName the host in deployVerify.allowedHosts if it is intended.

On the session itself, a runner that is off or has a different label shows "No runner picked the work up". See Holds.

Remove it​

helm uninstall sb-runner --namespace sb-runner
kubectl delete namespace sb-runner

Continue exploring