KiteGitHub
Quickstart

How it works

The control plane keeps the cluster as one log with one writer, on Cloudflare or on your own servers. Each node runs the node agent, which dials out to it.

Write latency, p9998 ms
Failover, writes resume3.65 s
Tested size5,000 nodes

Components

Clients call the Kubernetes API on the control plane. Each node runs the node agent and opens one WebSocket to the control plane, and nodes reach each other over WireGuard. kubectl, Helmany clientHTTPS 443Control planeserverlessWorkerevery API requestWritera Durable Objectholds the logControllersscheduler andcontrollersRelayshold node WebSocketsself-hosted, a Raft group of 3Followerreads, relays nodesLeaderthe writerFollowerreads, relays nodesmembers send the log to each other over mutual TLS/connect · WSS · outbound TCP 443Node agentnode-1containerd, podsNode agentnode-2containerd, podskitewg0UDP 51820Durable Object SQLiteeach server's own disk
Fig. 1 Clients call the Kubernetes API on the control plane. Each node opens one WebSocket to it, and nodes reach each other over WireGuard.

The control plane serves the Kubernetes API and runs no containers. Each node runs containerd and the node agent, which does the work of kubelet, kube-proxy, the network add-on and CoreDNS. The node agent opens one WebSocket to the control plane. The control plane never connects to a host, so a host needs only outbound TCP 443. Pod traffic between nodes goes over WireGuard and never passes through the control plane.

The control plane runs on Cloudflare or on your own servers. Both work the same way, and the two sections below say what differs.

Commit log

The control plane keeps the cluster in a commit log, and a single writer appends to it. Each committed write gets the next revision, which clients see as resourceVersion. The commit log does the job that etcd does in upstream Kubernetes.

  • Every write goes through the writer, which checks it against the log before it appends it. A write that names the resourceVersion it read fails with 409 Conflict when the object has changed since.
  • The scheduler and the controllers work from a copy of the log, so they do not hold up the writer. Each batch of their writes carries the revisions it read, and the writer refuses the batch when one of them has changed.
  • Nodes connect through relays, which hold the nodes’ WebSockets for the writer.

How nodes connect

  1. helloNode to control plane: what the node supports
  2. welcomeControl plane to node: a new credential for the node
  3. assignControl plane to node: its pods, peers and routes, as changes to what it has
  4. reportNode to control plane: the status of its pods and of the Node
  5. sharedControl plane to node: a peer or a route that changed for every node
  6. exec-streamControl plane to node: a stream that a client opened, such as kubectl exec
  7. exec-chunkNode to control plane: the stream's output, paced by the client's credit

After the first, an assignment carries only what changed since the one the node last applied. Logs, exec, port-forwarding and webhook calls use the same WebSocket. A log or exec stream moves only as fast as the client reads it.

Ports and connections

PinNameDirectionPortCarries
1Kubernetes APIinHTTPS 443Requests from kubectl, Helm and any other client.
2kitewg0between nodesWireGuard, UDP 51820Pod traffic between nodes. Open it between every pair of nodes. See Networking.
3/connectin, from nodesWSS, TCP 443Assignments, reports, logs, exec, port-forwarding and webhook calls. The control plane never opens a connection to a host. See Control connection.

Serverless

The control plane. Every write goes through one writer, which holds the log. On Cloudflare that is ClusterObject, behind a Worker, with a controller object and Replica objects. On your own servers it is the leader of a Raft group, with two followers. kubectl, Helmany clientHTTPS 443Control planeserverless: Durable Objects behind a WorkerWorkerreceives every API requestkeeps watches openWriterClusterObject, a Durable Objectholds the loglog10411042104310441045104610471048checks each write against the logControllersscheduler,controllers andendpoints sync, ona copy of the logRelaysreplica objects: keep the nodes' sockets,forward their messageslogwriteslogs, exec,port-forwardingself-hosted: a Raft group of 3Followera copy of the logserves readskeeps node WebSocketsforwards writes to the leader104210431044104510461047Leaderholds the writercontroller threadfollows the log104310441045104610471048Followera copy of the logserves readskeeps node WebSocketsforwards writes to the leader104210431044104510461047mTLSmTLSevery member serves the API and /connect, for example behind a load balancerstandbyPostgresor a bucket,without Raft/connect · WSS 443 · in from nodesNode agentnode-1Node agentnode-2Durable Object SQLiteeach server's own diskthe newest revision
Fig. 2 On Cloudflare: a Worker in front of the cluster's Durable Object, which is the writer, and the replica objects that relay the nodes.
  • A Worker receives every API request and forwards it to the cluster’s Durable Object. That object is the writer, and it keeps the log in its own SQLite.
  • Each node connects to one of the relays, Durable Objects called replica objects, which Kite chooses from the node’s name. The relay forwards the node’s messages to the cluster’s object, so the nodes stay connected when that object restarts. Cloudflare restarts the object when it reaches its memory limit, and closes the object’s own connections when a burst of new pods overloads it.
  • A relay sends each of a node’s reports to the object as a request, and Cloudflare bills a message on a node’s own connection at a twentieth of a request. So an idle cluster with no relays costs less. Keep nodes connected through a restart sets the number of relays.

Self-hosted

The control plane. Every write goes through one writer, which holds the log. On Cloudflare that is ClusterObject, behind a Worker, with a controller object and Replica objects. On your own servers it is the leader of a Raft group, with two followers. kubectl, Helmany clientHTTPS 443Control planeserverless: Durable Objects behind a WorkerWorkerreceives every API requestkeeps watches openWriterClusterObject, a Durable Objectholds the loglog10411042104310441045104610471048checks each write against the logControllersscheduler,controllers andendpoints sync, ona copy of the logRelaysreplica objects: keep the nodes' sockets,forward their messageslogwriteslogs, exec,port-forwardingself-hosted: a Raft group of 3Followera copy of the logserves readskeeps node WebSocketsforwards writes to the leader104210431044104510461047Leaderholds the writercontroller threadfollows the log104310441045104610471048Followera copy of the logserves readskeeps node WebSocketsforwards writes to the leader104210431044104510461047mTLSmTLSevery member serves the API and /connect, for example behind a load balancerstandbyPostgresor a bucket,without Raft/connect · WSS 443 · in from nodesNode agentnode-1Node agentnode-2Durable Object SQLiteeach server's own diskthe newest revision
Fig. 3 On your own servers: a Raft group of 3, where the leader is the writer and the followers relay the nodes.
  • kite-control is one process under systemd, with the scheduler and the controllers on a second thread. It keeps the log in SQLite on the server’s disk.
  • One server has no failover. For failover, add a standby that keeps the log in a Postgres database or copies it to an S3 or R2 bucket, and takes over when the server stops. See Add a second server.
  • Or run a Raft group of 3 or 5 servers, which elect the server that writes. The followers are the relays. kite deploy does not set up a Raft group.
PinNameDirectionPortCarries
1Raft peerbetween servers--raft-listen, mutual TLSThe log, under the cluster's certificate authority. Only in a Raft group.
2Standby storeoutPostgres, or S3 or R2The log, for a standby that takes over. Only without a Raft group.

Memory

KITE_MEMORY_MB sets the memory that the control plane may use. Each part below uses at most its share of it at a time:

PartShare
The cache of node stateA sixteenth
Sending each change to every nodeA sixteenth
Reading the pods of the ReplicaSets and Deployments that the controllers reconcileA sixteenth
The cache of recently read podsA thirty-second

In a large cluster, a part that needs more than its share works in rounds:

  • The control plane sends a change that is bigger than its share in several rounds, so the last nodes get it a moment after the first ones.
  • The controllers reconcile the last Deployments a moment after the first ones.

More memory lets each of these finish in one step. Size the cluster for its memory sets it.

On your own servers, the scheduler and the controllers keep their own caches with the same limits, so the control plane can use up to twice KITE_MEMORY_MB.

Limits

  • Each cluster has one writer. Every write goes through it.
  • The control plane runs no containers. Your workloads run on nodes.

Cluster address

Your kubeconfig contains the address as its server URL, such as https://kite.example.com. Every node connects to the control plane at this address too.

To set the address, see Use your own hostname.

Namespaces or a second cluster

To separate teams in one cluster, use namespaces, RBAC, resource quotas and NetworkPolicy. Deploy a second cluster when workloads need their own API, credentials or nodes.

Two clusters in one Cloudflare account or cloud project need different KITE_CLUSTER names. kite deploy gives a new cluster the name of its deployment, so two deployments get different names. See Share a cloud project between clusters.

Responsibilities

AreaKite providesYou provide
Control planeKubernetes API, RBAC, schedulingA Cloudflare account, or Linux servers
NodesThe node agentLinux hosts with systemd, apt and outbound HTTPS
Workload networkWireGuard overlay, DNS, Service rulesUDP between nodes, ranges that do not overlap
StorageVolume binding, CSI node operationsCSI drivers, StorageClasses, storage credentials

You also own each host’s operating system, firewall and capacity. Control plane costs lists what the control plane costs on Cloudflare.

Scale and performance has the cluster’s results against its targets, and Testing says how Kite is tested and what happens when a part fails.