BYO VMs

Bring your own VMs — Docker Compose or k3s, no managed Kubernetes bill

Point Simple Container at plain VPSs and it deploys there: a Docker Compose fleet with one container set per machine, or a multi-node k3s cluster SC installs itself and hands you a kubeconfig. One shared certificate across the fleet, or let Cloudflare terminate. No private network between the machines? SC builds a WireGuard mesh and runs the cluster on it. On Cloud.ru it creates the machine too. No control-plane fee, no registry the machines have to reach.

Any VPS, over SSH
provider: byo needs an address, a deploy user and a key. No cloud API, no agent on the machine, no SC account on the provider’s side. The one driver that works in every cloud on earth — and on a rack in your office.
One machine, or a fleet
A fleet is the same hosts: list with more entries. Every machine runs a full container set, rolled one host at a time so a bad image stops the roll; one A record per machine; host 0’s resources are byte-identical to a single-host deploy’s, so growing does not replace what you have.
Docker Compose, no Kubernetes
The vm-compose template runs your stack as a Compose project on each machine: blue/green slots with a health gate, Caddy terminating TLS with a real Let’s Encrypt certificate, previous images kept on disk for rollback.
Multi-node k3s that SC installs
The k3s-cluster resource installs a pinned k3s across your hosts over SSH and exports a kubeconfig. One server plus agents by default; servers: 3 opts into embedded etcd and a real HA control plane. A Kubernetes API with no managed control plane to pay for.
No private network? SC builds one
mesh: {enable: true} puts a WireGuard overlay across the resource’s machines and addresses the cluster on it — etcd, flannel and the kubelet talk over the overlay instead of the public NIC. Each key is generated on its own machine and never leaves it. The answer for cheap VPS hosting, which mostly sells no private networking at all.
One certificate for the whole fleet
ingress.acmeStorage points every machine at one S3-compatible store, so the fleet issues ONE certificate and any machine can answer any machine’s ACME challenge. Or set originTls: false and let Cloudflare or a load balancer terminate in front — the option that needs no shared state at all.
The same client.yaml
A stack that deploys to AWS Lambda deploys to a VPS by changing which template the parent stack points at. k3s-cluster even exports its kubeconfig under byte-for-byte the output names GKE Autopilot uses, so the Kubernetes layer above it is unchanged code.

Two plain servers linked to a small self-hosted Kubernetes boundary by a single secure channel

Why this exists

Kubernetes has become the default answer to “where does this run”, and for a team of fifty that is usually right. For a team of three shipping a portal, the managed version of it is a strange purchase: you pay a flat fee for a control plane you never look at, and you pay it per cluster.

The numbers are public and worth being precise about, because the honest version is narrower than the usual pitch:

  • Amazon EKS charges $0.10 per cluster per hour — about $72/month — before a single worker node. There is no free tier. A version past standard support costs $0.60/hour.
  • Google GKE charges the same $0.10 per cluster per hour in every mode, Standard and Autopilot alike, but credits $74.40/month against zonal and Autopilot clusters. So your first small GKE cluster is effectively free, and your second is not — and regional Standard clusters are not covered by the credit at all. Committed-use discounts do not apply to the management fee.

The flat fee is the visible half. The other half is the floor underneath it: a managed cluster wants worker nodes sized for system daemons before your container gets any room, so “the smallest thing that can run my app” is rarely the smallest thing you can rent. A €5 VPS is not a legal target for a managed Kubernetes offering. It is a perfectly legal target for a web service that gets a thousand requests a day — and three of them are a fleet.

And then there is the case that is not about money at all: a lot of clouds have no managed Kubernetes to buy. That is true across most of the Russian market, which is where this work started. If your cloud offers you a Linux machine and nothing else, a tool that only speaks to managed container services cannot deploy there.

The four types

These describe a machine, not a managed service, so they do not sit under any one provider:

TypeKindWhat it is
vmresourceone or more Linux machines SC can reach over SSH, plus the optional Caddy front door that terminates TLS on them
k3s-clusterresourcea k3s control plane installed on the hosts of a vm resource; exports a kubeconfig
vm-composetemplateruns a cloud-compose or single-image stack as a Docker Compose project on each machine
k3s-cloudruntemplatedeploys a stack onto a k3s-cluster through SC’s ordinary Kubernetes path

Which cloud creates the machine is the resource’s provider: field, not a separate resource type per cloud:

provider:Status
byoimplemented — the machines already exist; you give SC an address and a deploy key for each. The only driver that makes a fleet today
cloudru-vmimplemented — Cloud.ru Advanced (ex-SberCloud), via our bridged terraform-provider-sbercloud. One machine per resource
cloudru-evolution-vmimplemented — Cloud.ru Evolution, over its Compute REST API. One machine per resource
yc-vm, openstack-vm, vkcs-vm, mws-vm, timeweb-vmdeclared, not implemented — refused at validation with the roadmap item named, rather than accepted and ignored. Until one lands, create the machine in the console and declare it as byo

Compose on a machine

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# server.yaml — the parent stack
templates:
  compose-on-vm:
    type: vm-compose
    config:
      vmResource: portal-vm
      imageDelivery: ssh-tar      # default — stream the image over the deploy's own SSH
      externalImages: ship        # mongo, redis… ride the same stream
      strategy: blue-green        # default; `recreate` trades 502s for RAM
      keepImages: 3

resources:
  resources:
    staging:
      template: compose-on-vm
      resources:
        portal-vm:
          type: vm
          config:
            provider: byo
            hosts:
              - address: 203.0.113.10
                user: ubuntu
                privateKey: ${secret:PORTAL_VM_DEPLOY_KEY}
                hostKey: "203.0.113.10 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA..."
            ingress:
              enable: true              # Caddy owns 80/443 on this machine
              email: [email protected]    # the ACME account
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# client.yaml — the application stack, unchanged from the one that deploys to Lambda
stacks:
  staging:
    type: single-image
    template: compose-on-vm
    parent: mycompany/mycompany
    config:
      image:
        dockerfile: ${git:root}/Dockerfile
      maxMemory: 512
      domain: portal.example.com
      secrets:
        MONGO_URI: ${secret:staging-portal-mongo-uri}

Two details in there matter more than they look.

imageDelivery: ssh-tar is the default, and it is why this path exists at all. The built image is streamed over the same SSH connection the deploy already has, so no registry has to be reachable from the machine. With externalImages: ship, the images you did not build travel in the same stream — otherwise the machine would still need Docker Hub for every mongo and redis in your compose file, and the promise would be false. (Pin third-party tags when you ship them: the re-ship is keyed on the reference, so a tag that moves upstream is not noticed.)

ingress belongs to the machine, not to the template. One machine has one port 443. Caddy lives in its own Compose project because a stack’s project is destroyed and recreated on every deploy — a Caddy inside it would go down with the slot it is supposed to be routing traffic away from. A stack opts in by setting domain:, and its deploy then owns exactly one file in Caddy’s conf.d plus a reload, which is why two stacks can deploy to the same machine at the same time without a lock.

You do not have to install Docker. sc provision installs Docker Engine and the compose v2 plugin on a byo host that will need one — the same guarded install cloud-init performs on a machine SC creates, so a host that already has it is left alone. A host declared only as a k3s node gets none: k3s brings its own containerd, and Docker’s iptables -P FORWARD DROP next to flannel is a hazard rather than a convenience.

A fleet is the same list with more entries

Add machines to hosts: and every stack on that resource deploys a full container set onto each one:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# server.yaml — the same `portal-vm` resource, with three machines instead of one.
# The template above it does not change at all.
portal-vm:
  type: vm
  config:
    provider: byo
    hosts:
      - address: 203.0.113.10
        user: ubuntu
        privateKey: ${secret:PORTAL_VM_DEPLOY_KEY}
        hostKey: "…"
      - address: 203.0.113.11
        user: ubuntu
        privateKey: ${secret:PORTAL_VM_DEPLOY_KEY}
        hostKey: "…"
      - address: 203.0.113.12
        user: ubuntu
        privateKey: ${secret:PORTAL_VM_DEPLOY_KEY}
        hostKey: "…"
    ingress:
      enable: true
      email: [email protected]
      acmeStorage:                               # a fleet needs this — see below
        bucket: mycompany-acme
        endpoint: https://storage.yandexcloud.net
        region: ru-central1
        accessKey: ${secret:ACME_S3_ACCESS_KEY}
        secretKey: ${secret:ACME_S3_SECRET_KEY}
        encryptionKey: ${secret:ACME_S3_ENCRYPTION_KEY}
  • The roll is sequential. The next host starts only after the previous host’s new slot is live, so a bad image stops the roll instead of taking the fleet down. Blue/green stays within a host — each machine has its own slot pair and its own Caddy — and is not a cross-machine flip.
  • Host 0’s resource names are byte-identical to a single-host deploy’s, so growing from one machine to three does not replace the machine you already have.
  • The DNS record set is derived from the fleet. With a registrar declared in the parent stack, SC writes one A record per machine; with none declared it warns, naming the addresses, because hand-made DNS is supported. A registrar that keys records by name and type alone would have each record replace the previous one — a green deploy, a resolvable name, and 2/3 of the fleet never reached — so SC compares the references the registrar returns and refuses the provision on a duplicate instead.
  • No private network needed. Zero node-to-node traffic: each machine runs the full container set independently and the only shared state is the certificate store, reached outbound over HTTPS. That is why this is the shape that works on cheap VPS hosting, most of which sells no private networking at all.

The front door, stated honestly

OptionWhat it needsWhat it gives you
ingress.acmeStoragean S3-compatible bucketone certificate for the fleet; any machine answers any machine’s ACME challenge
ingress.originTls: falsenothing sharedCloudflare’s proxy or a cloud LB terminates in front; no ACME runs on the machines at all
a cloud load balancer—health checks and instant removal of a dead node — not built yet

Behind N A records, Let’s Encrypt’s validator reaches an arbitrary machine, which 404s a challenge token a different machine minted. Without a shared store each Caddy runs its own ACME client against the same name: N certificates, N sets of rate-limit consumption, split-brain renewals. acmeStorage makes it one. The three credentials never reach the rendered Caddyfile — it holds {$SC_ACME_S3_*} placeholders and the values arrive in a 0600 env file.

originTls: false is the other answer, and the only one that needs no shared state — which makes it the fallback on any cloud with no bucket to point at. It is also what makes domainProxied: true legal, since that refusal existed precisely because a proxy breaks the challenge the machine answers itself. Stated plainly rather than glossed: edge-to-origin is then cleartext over the public internet unless the machine’s firewall admits only the edge’s addresses. The generated Caddyfile says so too.

And multi-A DNS is load spreading, not failover. Measured, not asserted: with the edge on one of three hosts stopped, a client given all three addresses succeeded 6 of 6, served by a live host — and a client pinned to the dead address failed immediately and kept failing. A dead node costs roughly 1/N of requests a client-side retry. Nine sequential requests through one resolver all went to the same node, too: DNS round-robin is per-resolver, not per-request, so “1/N” is a property of the population of clients rather than of any one client’s traffic. For a node that can die invisibly, put Cloudflare or a load balancer in front and set originTls: false.

k3s, and why almost nothing above it changed

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# server.yaml
templates:
  k3s-run:
    type: k3s-cloudrun
    config:
      k3sClusterResource: ru-cluster
      # Required here, with no `ssh-tar` escape: a kubelet can only PULL.
      dockerRegistryURL: registry.example.ru/mycompany
      dockerRegistryUsername: ${secret:RU_REGISTRY_USERNAME}
      dockerRegistryPassword: ${secret:RU_REGISTRY_PASSWORD}

resources:
  resources:
    staging:
      template: k3s-run
      resources:
        cluster-vm:
          type: vm
          config:
            provider: byo
            # No private network between the machines? Drop every `privateAddress`
            # and set `mesh: {enable: true}` here instead — see below.
            hosts:
              - address: 203.0.113.10        # what you and SC reach it on
                privateAddress: 10.0.0.10    # what its SIBLINGS reach it on
                role: k3s-server
                user: ubuntu
                privateKey: ${secret:CLUSTER_VM_DEPLOY_KEY}
              - address: 203.0.113.11
                privateAddress: 10.0.0.11
                role: k3s-agent
                user: ubuntu
                privateKey: ${secret:CLUSTER_VM_DEPLOY_KEY}
              - address: 203.0.113.12
                privateAddress: 10.0.0.12
                role: k3s-agent
                user: ubuntu
                privateKey: ${secret:CLUSTER_VM_DEPLOY_KEY}
            # No `ingress` here — k3s keeps 80/443 for its own load balancer.
        ru-cluster:
          type: k3s-cluster
          config:
            vmResource: cluster-vm
            # servers: 3    # embedded etcd and a real HA control plane

A cluster’s entire contract with everything above it is two stack outputs: a kubeconfig and an ingress address. So k3s-cluster produces the same two outputs gcp-gke-autopilot produces, under the same names — and the Deployment, the Service, cloudExtras (probes, VPA, topology spread, security context), the helm operators for Postgres/MongoDB/Redis/RabbitMQ and the Caddy edge are the existing Kubernetes code, untouched. The only genuinely new thing is the template type, because a kubeconfig for a cluster SC is about to create cannot be written into a config file; it can only arrive as a parent-stack output. k3s-cloudrun and kubernetes-cloudrun differ in that and nothing else — and the in-cluster Caddy edge resolves the same way now, with kubeconfig: ${resource:ru-cluster.kubeconfig}, so one sc provision stands up the cluster and its edge together.

Three fields carry the multi-node design, and each exists because the alternative fails silently:

  • role: is all-or-none. SC will not guess which machine runs etcd, and the guess decides whether a machine joins the cluster at all. Mixing compose with a k3s-* role in one resource is refused too — one machine has one port 443.
  • servers: defaults to 1, which uses sqlite and has no etcd: the simplest thing that works, where losing the server loses the control plane but not the running workloads. servers: 3 opts into embedded etcd and real HA, and must be odd — two members tolerate zero failures, so they are strictly worse than one. etcd is latency-sensitive: across availability zones in one region is the intended topology, not across regions or hosters.
  • A multi-node pool needs a node-to-node address, and having neither way of giving it one is a refusal rather than a warning on purpose. SC passes that address to k3s as --node-ip (plus --advertise-address on servers). Without one, k3s advertises whichever address the machine’s default route carries — the public one on a single-NIC VPS — and then etcd peer traffic, which is the cluster’s entire state including every Secret, and flannel’s unencrypted VXLAN overlay cross the public internet. That deploy succeeds: every node Ready, nothing in the output saying the overlay is exposed. A failure mode that presents as success has to be refused.

The two ways of giving it one are privateAddress: per host, where the hosting provides a private network, and mesh: {enable: true} on the resource, where it does not:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
        cluster-vm:
          type: vm
          config:
            provider: byo
            mesh:
              enable: true       # the CIDR and port have defaults
            hosts:
              - address: 203.0.113.10     # no privateAddress anywhere
                role: k3s-server
                user: ubuntu
                privateKey: ${secret:CLUSTER_VM_DEPLOY_KEY}
              # …two more, same shape

SC generates each machine’s WireGuard key on that machine — no private key reaches the Pulumi state, a preview diff or a log — writes the peer set, and then addresses the cluster on the overlay: the join URL, --node-ip, --advertise-address and the node-to-node SANs are all overlay addresses. The interface is deliberately not called wg0, because a machine you brought may already have a hand-written wg0 and taking that name would cut your own access to the box. The WireGuard port faces the internet by design — a peer’s endpoint is its public address — which is safe because WireGuard answers nothing at all to a packet that does not authenticate against a known peer’s key. Where a cloud does give you a private network, keep using privateAddress: cheaper, faster, and already trusted by that cloud’s firewall.

The k3s version is pinned, not tracked. k3s’s installer resolves a release channel at install time, so a channel would make your control-plane version depend on the day the deploy happened to run. A channel name is refused.

What it refuses

A field SC cannot honour on a VM is an error, not a silent no-op:

FieldOn vm-composeWhy
clusterIPAddresserrorthere is no cluster — a stack is reachable at the address of each machine it was deployed onto
a bind mount in a compose fileerrorits source is a path on the developer’s machine, which does not exist on the VM
domainProxiederror while the machine terminates TLSa proxy in front breaks the ACME challenge the machine answers itself. On an originTls: false fleet the proxy is the front door and domainProxied: true is correct
scale.max > 1warninga three-host resource genuinely serves three replicas, one per machine — but the number is the host count on the parent’s vm resource, not this field’s to set. Scaling within a machine needs a k3s parent
scale.min: 0warningnothing scales to zero on a VM

provider: byo likewise rejects region, zones, image, size, publicIP, network, extraSshKeys and ingressPorts — SC did not create the machines, so it cannot resize, move or firewall them, and accepting those fields would read as a promise it is not making. Configure them in your cloud’s console; SC prints the port list it would have asked for so you can diff it against your security group rather than derive it.

hostKey is the one optional field whose absence has a real cost. A deploy carries the stack’s whole env file, every ${secret:...} in it, and the deploy key itself. Without a pinned host key the SSH client has nothing to check the machine against, and a CI runner has no known_hosts to fall back on — so SC warns loudly rather than inventing a default. It is the machine’s public key, deliberately not treated as a secret, so you can compare it against the cloud console by eye.

What is not here yet

Stated plainly, because the alternative is you finding out during a deploy:

  • Only byo makes a fleet. The cloud drivers still create one machine each. zones: and nodes: are accepted on them, and SC refuses a provision whose driver returned the wrong number of machines — naming the driver and both counts — rather than handing you a pool that is silently one machine. N-machine creation per cloud (Cloud.ru, then Yandex, GCP, AWS) is the next slice.
  • No cloud load balancer as a front door yet, so a fleet’s two options are the shared certificate store and letting an edge terminate.
  • acmeStorage takes literal bucket credentials — referencing an SC-managed bucket resource instead is the next step on that path.
  • Multi-A on a fleet needs Cloudflare today. The Cloud.ru and Yandex registrars get the duplicate-record refusal rather than a half-populated record set.
  • Only three machine drivers exist. Everything else is byo, which is not a limitation so much as a different division of labour.

Safe for agents, for the same reason it is safe for people

The whole point of describing a machine declaratively is that an AI agent can then operate it without being handed the machine. Secrets stay ciphertext-at-rest in git — an agent reading the repo sees encrypted blobs, never values — and on the way to the machine they travel as SSH stdin into a 0600 env file, never as a command-line argument and never into a log. The agent picks a template; it does not get a shell.

That is the same property that makes sc assistant and the SC MCP server reasonable things to point an agent at. The primitives are narrow enough that the worst outcome of a wrong choice is a refused sc provision.

Full reference and worked end-to-end examples — for a single machine and for a fleet — live in the docs.

Ship your infrastructure on autopilot.

Try the SC parent stack in your own repo, or see what we built on top of it — Forge, our flagship AI workflow engine for teams.