Kubernetes
A Kubernetes cluster kvbox runs for you. Pick a node size, get a kubeconfig, and use kubectl as you would anywhere.
A cluster is Kubernetes 1.37 (k3s) that kvbox sets up and keeps running. You say how big its nodes are and how many; you get back a kubeconfig, and from there it is kubectl, Helm and manifests as on any cluster.
kvbox k8s create prod --size m # two nodes of 4 vCPU and 8 GB; takes a few minutes
kvbox k8s kubeconfig prod > prod.yaml # the cluster's admin kubeconfig
kubectl --kubeconfig prod.yaml get nodescreate waits until the API answers and every node is Ready, then prints what a month of the cluster costs.
| Option | Default |
|---|---|
--size <s|m|l> | required: what each node is sized at |
--nodes <n> | 2 (1 to 9) |
--near <box> | any server with room; with it, the server of that box |
--location <country or region> | your default location; with it, only servers inside it |
--no-wait | wait until the cluster is ready |
A cluster's name is 1 to 8 characters: lowercase letters, digits and -.
What a cluster is made of
A master, which kvbox runs. It holds the Kubernetes API and the cluster's own services. You never see it in kvbox ls, you cannot open it, and none of your pods run on it.
Nodes, which are boxes of yours. Your pods run here. Each node is a box named after its cluster (prod-3f2), listed by kvbox ls with "(node of prod)" beside it.
| Size | vCPU | Memory | Disk |
|---|---|---|---|
s | 2 | 4 GB | 8 GB |
m | 4 | 8 GB | 16 GB |
l | 8 | 16 GB | 32 GB |
You can open a node like any box (kvbox connect prod-3f2, kvbox exec), read its usage and resources, and back it up. What would change it is refused, with the command to use instead: you do not stop, resize or remove a node, you change its pool.
kvbox k8s ls # your clusters
kvbox k8s info prod # status, nodes and whether each is Ready, cost, addressesThe kubeconfig
kvbox k8s kubeconfig prod prints the file and nothing else, so it can go straight into a file or a pipe. It is made when you ask and kvbox keeps no copy.
Whoever holds it is the cluster's administrator. Treat it like a password: do not commit it, and give teammates access through the org instead of passing the file around. Every member can ask for it, but it is the same file for all of them: one admin certificate, not one per person. Removing somebody from the org does not take back the copy they saved.
The API's address and port are the cluster's for its whole life, so a kubeconfig you saved keeps working after a stop and start. It does not work for ever: the certificate in it lasts a year at most, and stops earlier when you rotate. When a saved file is refused, ask for a new one.
Give a cluster new credentials
kvbox k8s rotate prod # asks first; every kubeconfig handed out so far stops working
kvbox k8s kubeconfig prod > prod.yaml # the new oneUse rotate when somebody who had the kubeconfig, or could connect to a node, should no longer have the cluster: a person who left, a laptop that was lost, a file that ended up where it should not be. The cluster gets new certificate authorities and new join tokens. Its master restarts (the API is away for a minute or so), then every node restarts together and is waited for until it is Ready again. Your apps are down for those few minutes: once the master has the new authorities no node can talk to it until it has restarted too, so pick a quiet moment. Every box of the cluster must be running.
What rotate does not end is anything made inside the cluster: a service account and its tokens, a pod somebody left behind. If you rotate because of a person, look at those too. A backup taken before a rotation holds the old credentials and cannot be restored afterwards; take a new one once the rotation is done.
Rotating is for whoever may remove the cluster: you, or in an org its owners and admins, and a member for a cluster they created.
Node pools
A pool is a group of nodes of one size. A cluster is made with one pool, default; add others when you want a different size beside it.
kvbox k8s pool ls prod
kvbox k8s pool add prod --size l --nodes 3 --name big # a second pool; the name defaults to the size
kvbox k8s pool resize prod big --nodes 5 # more nodes
kvbox k8s pool resize prod big --nodes 2 # fewer; asks first
kvbox k8s pool rm prod big # the pool and its nodes; asks firstA pool's size never changes: for bigger nodes, add a pool and remove the old one. A pool holds at most 9 nodes, and a cluster always keeps at least one node.
More nodes are made on the server the cluster started on and join by themselves. When that server is full, the pool grows onto another one: in the same country first, in another country only when no server there has room, and never outside the location the cluster was made under. You do nothing different. A node on another server takes up to a minute longer to join, and kvbox k8s info and pool ls name the country of a node that is not in the cluster's own (prod-a41 (DE)). If there is no room for all of them anywhere, nothing is made and the message says how many would fit (kvbox k8s info prod shows the room too).
This is room to grow, not a second copy of the cluster: see Limits. A cluster made before nodes could be on several servers keeps all of them on its own server, and is refused with that reason when it is full; a cluster made now can grow further.
Fewer nodes leave one at a time, the newest first. Each is drained first: Kubernetes moves its pods to the other nodes, then the node's box is removed. Two things can stop it:
- A node that keeps data on its own disk (see Storage) is refused before anything changes, with the volume claims it holds. Move or delete that data, or add
--forceto remove the node and lose it. - A drain that does not finish, usually a PodDisruptionBudget that allows no pod to leave or a pod that will not stop. The command stops there and says which node; that node is left cordoned (no new pods), the others are untouched. Fix what blocks it and run the same command again, or
kubectl uncordon <node>to keep the node.
One change runs in a cluster at a time. A second one started meanwhile is refused; try again when the first is over.
Put an app on the internet
A cluster has no public address until you give it one. There are two kinds, and a cluster can have several of each.
kvbox k8s proxy claim prod shop # https://shop.kvbox.app
kvbox k8s domain add prod shop.example # your own domain; prints the DNS records to set
kvbox k8s proxy ls prod
kvbox k8s domain ls prodEvery address of a cluster arrives at its ingress controller (Traefik, which comes with the cluster). An Ingress with that host name says which app answers:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
spec:
ingressClassName: traefik
rules:
- host: shop.kvbox.app
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: shop
port:
number: 80- kvbox handles HTTPS. It makes and renews the certificate for every address and passes plain HTTP to the cluster. Write the Ingress without a
tls:section, and do not install cert-manager: it has nothing to do here. - Tell kvbox about every host name. An Ingress for a name you did not claim or add receives nothing. One cluster serves many apps this way: one address per app, one Ingress per address.
- A custom domain works as for a box: set the records
domain addprints, and it goes live within a minute or so of the DNS change (Custom domains has the details). If you also set thewwwrecord,www.shop.examplearrives under that name: add it as a secondhostin the Ingress. - Your app sees the visitor's address and
httpsin the usual forwarded headers. WebSockets work.
Only HTTP and HTTPS reach a cluster from outside. A Service of type LoadBalancer or NodePort gets no public address; for anything else, use kubectl port-forward from your machine.
To take an address away: kvbox k8s proxy release prod shop and kvbox k8s domain rm prod shop.example.
Storage
A cluster comes with one storage class, local-path. A PersistentVolumeClaim that uses it gets a folder on the disk of the node its pod runs on. That has consequences worth knowing before you put data there:
- The data lives and dies with that node. The pod can never move to another node, and removing the node removes the data, which is why shrinking a pool refuses a node that holds any.
- It is not in the cluster's backups.
- It shares the node's disk (8, 16 or 32 GB by size) with the node's system and container images.
Use it for caches and for anything you can rebuild. For data you cannot lose, keep it outside the cluster: a managed Postgres or Redis, or object storage, each with its own backups, and link the cluster to it.
Reach a database or a box
Pods reach nothing of yours outside the cluster until you link it.
kvbox k8s link prod orders # a managed database, on its own port
kvbox k8s link prod api --port 8080 # or one port of a box
kvbox k8s links prod
kvbox k8s unlink prod ordersThe command prints the address pods use: orders.<account>.kvbox and the port (your username, or the org's slug). It resolves inside the cluster, so it goes in a connection string as it is:
env:
- name: DATABASE_URL
value: postgres://orders:<password>@orders.<account>.kvbox:5432/ordersA link covers the whole cluster: every node it has now and every node added later. Linking is always done from the cluster's side, with kvbox k8s link; kvbox pg link and kvbox vm link are for boxes and refuse a cluster.
Backups
kvbox k8s backup create prod # start one now (--wait stays until it is done)
kvbox k8s backup ls prod # newest first
kvbox k8s backup restore prod <id> # the cluster goes back to the backup; asks first
kvbox k8s backup schedule prod --at 3 # its nightly backup at 03:00 UTC (--off, --on; alone: shows when)A backup holds what the cluster knows: your deployments, services, secrets, config maps and its list of nodes. It does not hold what pods wrote to local-path volumes, nor your container images.
Every cluster is backed up on its own each night from the moment it is created, and those backups are included in its price. One you start by hand costs the price of a backup. All are kept 30 days.
restore puts a running cluster back to the backup: everything applied since is gone, and the API is away for a minute or so while the master restarts. The kubeconfig, addresses and links stay as they are. Nodes are matched up afterwards: one you removed since the backup is taken off the cluster's list again, one you added since is restarted so that it joins again. The command says what it did, and warns about anything left for you.
A removed cluster's backups stay listed for their 30 days, but a backup cannot make a new cluster yet.
Stop, start, delete
kvbox k8s start prod # master and nodes back up
kvbox k8s rm prod # asks first; nodes, master and everything in the clusterThere is no stop command: a cluster runs until you remove it. It stops in one case, when the account runs out of credit: then the whole cluster is hibernated together, nothing in it lost, and kvbox k8s start brings it back after a top-up.
When something is wrong
kvbox k8s info prod says how the cluster is as one thing, and for each thing wrong the command that puts it right:
| Status | What it means |
|---|---|
ready | The master answers and every node is Ready. |
starting | The master or a node booted in the last five minutes and has not answered yet. |
degraded | The master answers, but a node does not, has stopped, is on a server that does not answer, or a pool is short of a node. Each one is named. |
down | The master is not running or does not answer. Pods on the nodes may still be running. |
unknown | The server the master is on does not answer, so nobody can say. |
kvbox k8s start prod # a stopped or sleeping master or node: all of them back up
kvbox k8s node restart prod prod-3f2 # a node that runs but the cluster gets no answer from it
kvbox k8s node restart prod prod # the same for the master: its name is the cluster's
kvbox k8s node restart prod prod-3f2 # certificates about to end: a restart renews them for a year
kvbox k8s pool resize prod default --nodes 2 # a pool short of a node: the same number again makes it
kubectl delete node prod-old # a node the cluster still lists that is no box of it any more
kvbox k8s rm prod # no server has the master any more: the cluster cannot come backKubernetes' own certificates last a year and are only renewed when a box restarts. A cluster that has run for eleven months says so here, for its master and for each node, 30 days before they end; restart the box it names and they are good for another year. Nothing else is needed. A node renews its certificates at every restart, so one that restarted in the meantime for any other reason has new ones already; the master renews its own only at a restart within 120 days of their end, which is why it is the one that tells you.
An org's cluster is named with its org in these commands (acme/prod). A node whose box went missing leaves its pool within minutes; the resize above then makes it again. A node on another server that does not answer has no command: nothing can be done to it until that server is back.
Restarting one node leaves the pods on the others running; the node joins again by itself, and so do the nodes after the master restarts. After a server restarts, the boxes of the cluster on it are booted again and come back without a command. kvbox never repairs a cluster on its own: it names the node and the command, and you run it.
Price
A cluster costs what its boxes cost, by the hour: the master is about $7 a month, and each node is the price of a box of its size (Sizes). A cluster with two s nodes is about $31 a month. There is no fee for the cluster itself.
kvbox k8s create and kvbox k8s info print what a month of yours costs as it is now. In kvbox usage a cluster has a table of its own, with its master and each node; none of them is counted again among your boxes.
Orgs
A cluster belongs to you or to an org, like a box: --org <slug> on any command. Members see an org's clusters and may get the kubeconfig; pools, addresses, links, new credentials (rotate) and removal are for whoever created the cluster and the org's admins.
Limits
- One master. Nodes can be on several servers, but that only gives a cluster more room. It still has one master: when the master's server is down, the API and the cluster's addresses are down too, though pods on nodes elsewhere keep running.
- No upgrades yet. A cluster stays on the Kubernetes version it was made with.
- HTTP and HTTPS only from outside, through the cluster's addresses.
- 5
kvbox.appnames per cluster, and 10 custom domains per account, the ones on your boxes included. - 9 nodes per pool. The master and the nodes also count toward the number of boxes your account may have.
- Node disks are fixed by the size; volumes do not follow a pod from one node to another.