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.
Components
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
resourceVersionit 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
helloNode to control plane: what the node supportswelcomeControl plane to node: a new credential for the nodeassignControl plane to node: its pods, peers and routes, as changes to what it hasreportNode to control plane: the status of its pods and of the NodesharedControl plane to node: a peer or a route that changed for every nodeexec-streamControl plane to node: a stream that a client opened, such as kubectl execexec-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
| Pin | Name | Direction | Port | Carries |
|---|---|---|---|---|
| 1 | Kubernetes API | in | HTTPS 443 | Requests from kubectl, Helm and any other client. |
| 2 | kitewg0 | between nodes | WireGuard, UDP 51820 | Pod traffic between nodes. Open it between every pair of nodes. See Networking. |
| 3 | /connect | in, from nodes | WSS, TCP 443 | Assignments, reports, logs, exec, port-forwarding and webhook calls. The control plane never opens a connection to a host. See Control connection. |
Serverless
- 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
kite-controlis 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 deploydoes not set up a Raft group.
| Pin | Name | Direction | Port | Carries |
|---|---|---|---|---|
| 1 | Raft peer | between servers | --raft-listen, mutual TLS | The log, under the cluster's certificate authority. Only in a Raft group. |
| 2 | Standby store | out | Postgres, or S3 or R2 | The 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:
| Part | Share |
|---|---|
| The cache of node state | A sixteenth |
| Sending each change to every node | A sixteenth |
| Reading the pods of the ReplicaSets and Deployments that the controllers reconcile | A sixteenth |
| The cache of recently read pods | A 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
| Area | Kite provides | You provide |
|---|---|---|
| Control plane | Kubernetes API, RBAC, scheduling | A Cloudflare account, or Linux servers |
| Nodes | The node agent | Linux hosts with systemd, apt and outbound HTTPS |
| Workload network | WireGuard overlay, DNS, Service rules | UDP between nodes, ranges that do not overlap |
| Storage | Volume binding, CSI node operations | CSI 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.