Move a cluster
A move carries a cluster through its copy in a bucket, with its credentials and issuer. Move a cluster to change its jurisdiction, or where its control plane runs.
| From | To | Command |
|---|---|---|
| A Worker | Another Worker | kite deploy move --name <from> --to <to> |
| A Worker | A Cloudflare Container | kite deploy move --name <from> --to <to> --container |
| A Cloudflare Container | A Worker | kite deploy move --name <from> --to <to> |
| A Worker | Your own server | kite deploy move --name <from> --to kite-control --host root@<server> --address <address> |
| Your own servers | A Worker | kite deploy move --name <servers> --to <to> |
Before you begin
The cluster must keep a copy in an S3
or R2 bucket. A cluster on your own servers keeps one when you set KITE_COPY,
as in Add a second server.
Move to another Worker
-
Put the settings that the new deployment changes, such as
KITE_JURISDICTION, in its settings file. -
Run the move:
kite deploy move --name <from> --to <to>
The move deploys <to> with the cluster’s credentials and issuer. <to>
starts as a standby: it restores the cluster from the copy, then reads each
change as it is written to the copy. Once <to> has caught up, the move:
- Stops
<from>cleanly. - Waits for
<to>to take over the copy. - Routes
KITE_HOSTNAMEto<to>.
Keep the copy in another bucket
To have <to> keep the cluster in a different copy after the move, such as a
bucket in another account, put that copy’s KITE_COPY and account settings in
<to>’s settings file. <to> first takes over <from>’s copy. Then it copies
the cluster to its own copy, and writes only there. From then on, <from>’s
copy stops changing, and no server takes it over.
After the move
<from> stays stopped with its data, and returns 503 for every request.
| To | Do |
|---|---|
Serve from <from> again, before another cluster takes over the copy | Send POST /kite/copy/resume to it with its admin token |
Remove <from> | Run kite deploy destroy --name <from> --keep-machines |
Keep the machines, because the NodePools and their machines belong to <to>
after the move.
Move to a Cloudflare Container
A cluster that outgrows a Worker’s memory can move to kite-control in a
Cloudflare Container, behind a Worker of its own. The Worker keeps the address
and the nodes’ connections, and forwards every request to the Container.
kite deploy move --name <from> --to <to> --container
The move deploys <to> as a Worker with a Container. kite-control in the
Container restores the cluster from the copy and follows it. Then the move
stops <from> and routes KITE_HOSTNAME to <to>, as a move to another Worker
does.
The Container loses its disk each time it starts again, so kite-control
restores the cluster from the copy as it starts. Until it has restored the
copy, the cluster returns 503. The Container is standard-1, with 4 GiB of
memory and half a vCPU. To choose another
instance type,
set KITE_CONTAINER_INSTANCE_TYPE in <to>’s settings file before the move.
The deploy token needs the Workers Containers Write permission, which
kite deploy credentials grants when the settings file sets
KITE_BACKEND=container.
Run a standby Container
Set KITE_CONTAINER_STANDBY=1 in <to>’s settings file to run a second
Container. kite-control in it follows the copy. When the Container that
serves stops, the standby takes the copy over, at once after a clean stop and
otherwise once the copy’s lease runs out. The Worker sends each request to the
Container that serves.
To restart the kite-control of one Container, such as one that stops
responding, send POST /kite/container/restart?object=control or
?object=standby with the admin token. With a standby, the other Container
takes over, and the restarted one stands by.
Grow into a Container on its own
A cluster on a Worker can move itself to a Container before its memory refuses a pod. Set this in its settings file, and deploy:
KITE_AUTO_GROW=container
Each deploy then also pushes the Container’s image and creates its
application, as a deploy with KITE_BACKEND=container does, but nothing starts
the Container. Auto-grow needs KITE_COPY, because the Container takes the
cluster over from its copy. The deploy token needs Workers Containers Write,
which kite deploy credentials grants when the settings file sets
KITE_AUTO_GROW.
Once the control plane’s memory has stayed at MemoryLow or MemoryFull for
10 minutes, the cluster moves:
- It starts the Container.
kite-controlthere restores the copy and follows it, while the cluster keeps serving on the Worker. - Once
kite-controlfollows the copy, the cluster stops cleanly, andkite-controltakes the copy over at once. Writes pause for as long as that takes. - The Worker sends every request to the Container from then on. The address, the credentials and the nodes stay the same.
The cluster records the Warning Event MovingToContainer on the
cluster summary as it
starts, and MovedToContainer once the Container serves, with how long each
step took. During the move, the summary’s controlPlane.growing says which
step it is on. If a step fails before the clean stop, such as a Container that
does not start or a copy that does not restore within 30 minutes, the cluster
keeps serving on the Worker, records GrowFailed with the reason, and tries
again an hour later.
The next kite deploy reads that the cluster moved and records
KITE_BACKEND=container in its settings file. Until the move, the Container
costs nothing. After it, the Container runs all the time and is billed at
Cloudflare’s Containers prices.
To move the cluster back to its Worker, once it has shrunk:
kite deploy move --back --name <name>
- The Worker empties its own copy of the cluster, restores the copy that
kite-controlwrites and follows it, while the Container keeps serving. - It checks that the cluster’s store holds at most half of what it held when the cluster grew, so it fits on the Worker with room to spare.
- It stops the Container cleanly and takes the copy over. Writes pause for as long as that takes, then the Worker serves every request again.
If the cluster is still too large, or the Worker does not follow the copy
within 30 minutes, the cluster stays in its Container and the command says why.
If the Worker does not serve within 5 minutes of the Container’s stop, the
Container starts again and takes the copy back. Once the Worker serves, the
command removes KITE_BACKEND=container from the settings file. The cluster
records MovedToWorker on the cluster summary with how long each step took,
and auto-grow can move it to its Container again later.
To move the cluster to another Worker instead, move it without --container:
kite deploy move --name <to> --to <worker>
Move from a Worker to your own server
kite deploy move --name <worker deployment> --to kite-control \
--host root@kite.example.com --address https://kite.example.com
The move installs kite-control on the server with the Worker’s credentials,
as a standby that reads the Worker’s copy. Once the server has restored the
copy and applies new writes as they arrive, the move stops the Worker cleanly.
Then it waits for the server to take over the copy and serve the cluster. When
the move finishes, point kite.example.com at the server.
Move from your own servers to a Worker
Pass the deployment on your servers as --name:
kite deploy move --name <servers> --to <to>
The move stops every server, and stops the one that serves the cluster last. Then point nodes and clients at the Worker’s address, which the move prints.
Next
- Configure a deployment: the settings of a cluster on a Worker.
- Deploy to your own servers: run the control plane on a Linux server of your own.