Coming from Kubernetes, Helm, Proxmox or compose

kubectl and Helm, as they are #

kithd answers the Kubernetes API on its own port (/api and /apis beside /v1), so kubectl and helm (3 and 4) work against a kith cluster with the manifests and charts you already have, nothing rewritten or migrated. Nothing of Kubernetes runs: no API server, etcd or kubelet. kithd holds each object as the kith resource it means, and gives it back as it was sent.

A kubeconfig is an Identity's certificate (Who may do what):

kith identity cert alice --out .    # alice.crt, alice.key and the cluster's ca.crt
# kubeconfig, beside those three files
apiVersion: v1
kind: Config
current-context: kith
clusters:
- name: kith
  cluster: { server: "https://NODE:7443", certificate-authority: ca.crt, tls-server-name: kith }
users:
- name: alice
  user: { client-certificate: alice.crt, client-key: alice.key }
contexts:
- name: kith
  context: { cluster: kith, user: alice }
export KUBECONFIG=$PWD/kubeconfig
kubectl apply -f manifests/               # a directory written for Kubernetes
kubectl rollout status deployment/shop
kubectl get pods -o wide                  # a pod each, with an address of its own
kubectl logs shop-0
helm install site ./chart --wait
KubernetesWhat kith holds
Deployment, StatefulSeta Workload whose replicas are pods (pod: true: a pod)
DaemonSeta NodeWorkload
Job, CronJoba Job, a CronJob (its Jobs are made by the clock, in UTC, a missed minute made up within startingDeadlineSeconds; the last three that succeeded and three that failed are kept, or successfulJobsHistoryLimit and failedJobsHistoryLimit)
Service, Namespacea Service, a Namespace
Ingressexpose on the Service behind each host, its Prefix and Exact paths as paths; the Ingress itself is kept to be read back. Refused by name: a path that is a pattern, an annotation that rewrites or matches by pattern, and one that keeps clients out (auth-*, an allow or deny list, a snippet, middlewares), which kith's edge would not honour
ConfigMap, Secreta ConfigMap, a Secret (Helm keeps its releases in Secrets: they are kith Secrets)
PersistentVolumeClaima VolumeClaim that says provision: true: a Volume is made for it on a node
ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding, PodDisruptionBudget, IngressClasskept as sent (a KubeObject), read back, and said to give nothing
A bare Pod (a Pod sent by POST or server-side apply)a Job when its restartPolicy is Never or OnFailure, a one-replica Workload when it is Always or none is said, marked kith.dev/pod, with its fields carried as a Deployment's template's are. It is read back as the Pod sent, by its own name (not NAME-j0), owned by nothing; nodeName, hostNetwork, activeDeadlineSeconds and the rest kith does not carry are refused by name. Its name is one name space with Jobs, Workloads and their pods (a taken one is a 409 AlreadyExists, in either order: a Deployment, StatefulSet, DaemonSet or Job made after a bare Pod named as one of its pods, NAME-0, NAME-j0 or NAME-n0, is refused too, whichever replica number), and sending it needs apply on the Job or the Workload it becomes. A change to one that is there is refused. kubectl logs finds it by its own name, and exec finds it as it does any pod (the same 403 for any name when the caller has no right on Jobs or Workloads; a caller with the right on one of them is told 404 for every name the other holds, there or not). kubectl delete pod NAME deletes it (it needs delete on the Job or the Workload it is held as; the kith.dev/pod mark is what tells it from a pod an owner runs, which a delete restarts)
Pod, ReplicaSet, Node, Eventmade for reading from what kith runs: kubectl get pods, describe, logs (a Deployment's kept revisions are ReplicaSets too, one for each template they held, numbered by the revision that last held it and read only: a write or a delete of one is a MethodNotAllowed; a pod's name says what runs it, so a Deployment and a Job of one name make two: a Deployment's or StatefulSet's pods are NAME-0, a Job's NAME-j0 and a DaemonSet's NAME-n0)

What works, by the real clients in the tests (sh ci/kube.sh, and sh ci/kube.sh --vm for what needs pods that run):

ClientWhat works
kubectlapply (client-side and --server-side), create (deployment, job, job --from=cronjob/…, cronjob, configmap, secret, namespace, serviceaccount), get (tables, -o yaml|json|wide|name|jsonpath, -A, --watch, get all), describe, diff, replace, patch (strategic, merge and --type json: the six RFC 6902 operations, a failing test or a path not there refuses the whole patch with a 422), label, annotate, scale, expose, set image, rollout status, rollout restart, rollout history and rollout undo of a Deployment (with and without --revision and --to-revision: the history is the revisions kith kept of it, at most 100 and only those made through this API, and an undo is kith rollback to the newest revision that held that template, so unlike Kubernetes's, which restores the template alone, it restores the whole revision: its replicas, labels, annotations and strategy too, and an undo after a kubectl scale scales back to what that revision held; it takes the rights a rollback takes, and it is refused with a 409 if a write landed on the Deployment after kubectl read it (run it again); to the template it has now kubectl says "skipped rollback"), wait, logs (-f, --tail, of a pod, a Deployment or a Job), run NAME --image=IMAGE (a pod alone: with --restart=Never it is a Job, else a one-replica Workload; see the bare Pod above), delete (a pod an owner runs restarts that replica in place: the same name, a new start time, the other replicas untouched; it needs apply on the Workload. A bare pod is deleted, not restarted, and needs delete on what it is held as; a name that is no pod is NotFound)
helminstall, upgrade, rollback, uninstall, list, status, history, get manifest, each with and without --wait, into a namespace it creates; test (a chart's test hook is a bare Pod: Helm 3 makes it by a create and Helm 4 by a server-side apply, and kubectl delete pod removes it)
Field managerskubectl apply --server-side keeps who set which field (metadata.managedFields, up to 64 managers an object). Managers that apply one object each keep their own fields; a second manager's different value for a field the first set is a 409 Conflict in Kubernetes's words, unless it says --force-conflicts (it then takes the field). A field a manager leaves out of its next apply goes, when no other manager has it. Fields are owned by their exact path, a list with no one key to merge by is owned whole, and only an apply makes a manager (a replace or a patch takes a field from whoever had it). Applying onto an object that exists, or replacing one, needs get as well as apply, as a patch does
AGEkubectl get namespaces and get nodes show the time of the oldest revision the store kept: when it was made, unless the history was trimmed or the node is a worker that runs from a view and holds only what the view carried (an implicit namespace, one that only holds objects, has none)
Watcheskubectl get --watch reads what the store says changed, so one change among 2000 objects makes and compares one object, not 2000 (it shows what a list shows: the same Roles apply). It reads the kind again when it cannot know what changed: on a worker node that runs from a view, after a change to an Identity, a Role or a RoleBinding, after more than 4096 changed keys, after the store was replaced, and for Namespaces
exec, cpkubectl exec, also kubectl exec -it (stdin, stdout, stderr and the exit status; with -t the process has a terminal of its own and follows the window kubectl sends) and kubectl cp, both ways (a tar run by exec, so the image needs one), for a pod of a Workload or a Job, as the caller who has the exec right on what owns the pod. The process runs in the replica's own mount, pid and net namespaces on the node that runs it; asked of another node, the request crosses by the one route that port-forward uses too (/v1/pod-hop, between control nodes), which checks the caller and the exec right again at the replica's node. A kithd that is not root has one id in a replica: a tar that gives files their senders' ids needs --no-same-owner. A kube request is unsigned, so where signing: required the other node may refuse the hop. vm.sh --test kube runs both across two kith OS nodes with the real kubectl, and a person who may only read is refused
port-forwardkubectl port-forward POD LOCAL:REMOTE (the WebSocket kubectl asks for first; the older POST upgrade is refused), for a pod of a Workload or a Job, as the caller who has the exec right on what owns the pod (get alone is refused, before anything is upgraded). The bytes go both ways to the pod's own address and the port asked, over the node that runs the replica; a connection that moves no byte for 5 minutes ends, and so does a session with no connection that hears nothing (kubectl's pings are heard); a session carries 16 connections and a caller has 8 sessions at a node. The exec right is asked again for each new connection (here, and again at the node that runs the replica): a binding taken away refuses the next connection, and ends none that is open. A pod that is not made on its node yet (still starting) is refused, never answered by the host's own ports. TCP only, and not to a NodeWorkload's host unit
GitOpsa Source follows a repository of Kubernetes manifests as they are; a file's objects are read exactly as the API reads them
Every fieldaccounted for by one table (crates/kith-kube/src/lib.rs): carried into the kith resource, or taken with a Warning: that it changes nothing (kubectl prints it), or the object is refused with a status that names the field. Nothing is dropped in silence, and kubectl get -o yaml gives back what was sent

Not answered, each refused in words:

WhatNote
A write to a resource's /status (a controller's, or kubectl patch --subresource=status)status is kithd's own, written from what runs, not taken from a client. Reading works
attach; exec or cp into a Job's finished run or a NodeWorkload's host unitattach is refused by name, as is a NodeWorkload's host unit and a run that is over
kubectl run -it (an attach), kubectl top; CustomResourceDefinitions (so other people's operators), admission webhooks, NetworkPolicy, HorizontalPodAutoscaler
What it is not, and is not meant to becomekith is not a conformant Kubernetes (the conformance tests are not run and would not pass). It takes no CNI, CSI or device plugin (a pod's network, a volume and a device are kith's own), serves no aggregated API, and never starts, fetches or packages Kubernetes: what needs the real thing needs a real cluster
In a pod: hostNetwork, hostPID, hostIPC, hostPath, privileged, added capabilitieskith gives no Workload these, by any API
In a pod: a projected or downwardAPI volume, a mode for one item of a volume, an initContainer with a restartPolicy (a sidecar)What a chart commonly says is carried, as kith's own fields: volumes from a ConfigMap, a Secret or an emptyDir, subPath of any of them, envFrom, fieldRef, initContainers, runAsNonRoot, dropped capabilities, and limits.ephemeral-storage with a disk emptyDir's sizeLimit as resources.storage (either under 64Ki raised to it)
A CronJob in a time zone other than UTCwrite the schedule in UTC
kubectl rollout history and undo of a StatefulSet or a DaemonSet (their history is ControllerRevisions, a kind kith does not make), a change-cause (--record), revisionHistoryLimituse kith history and kith rollback
--cascade=orphan, kubectl logs --previous, --since, --timestampsa unit's output is kept as it was written, not when

What it costs: it is in the one kithd there is and added 0.38 MB to it, and the JSON patch 0.01 MB more (the budget, then 13 MB, was not raised for it; kithd was 12.72 MB then). With pods and CronJobs kithd with nothing to do holds 7.8 MB of memory, as before (python3 ci/budgets.py); a node no client asks runs none of it.

Who may do what is kith's own: a request on /api is checked as the same request on /v1 would be, for the kith kind it means, by the Roles bound to the certificate's Identity (a kubectl patch needs get as well as apply; a CronJob needs apply on Job, a PersistentVolumeClaim on Volume). Kubernetes's Roles and ServiceAccounts give nothing. What kith's own files made is not shown as a Kubernetes object, nor written over through this API.

Importing from Kubernetes and Helm #

kith import k8s -f manifests.yaml (-f - reads stdin; -f may repeat; a List is unwrapped) prints the kith resources the manifests translate to. kith import helm ./chart --name shop -n store -f values.yaml runs your installed helm template and translates what it prints (no helm: pipe helm template ... | kith import k8s -f -). Review the output, then kith apply -f it.

Kuberneteskith
Deployment, StatefulSetWorkload with pod: true (a StatefulSet's volumeClaimTemplates each become a VolumeClaim for each replica, <template>-<name>-<ordinal>, and its mount is perReplica: each replica its own. Scaling down keeps the claims and their data, as Kubernetes does, and scaling up again finds them)
DaemonSet, ServiceNodeWorkload, Service
Ingressexpose: {host, via: edge, paths} on the Service behind each host (the one behind /, else the first named)
ConfigMap, SecretConfigMap, Secret (data decoded from base64: the output holds the plain text)
PersistentVolumeClaimVolumeClaim, with provision: true unless it says storageClassName: ""
Job, CronJobJob, CronJob (startingDeadlineSeconds, successfulJobsHistoryLimit and failedJobsHistoryLimit are kept to; a timeZone other than UTC is refused)
nodeSelector, a pod template's labelsa placement requirement; the labels are added to the workload's, since kith Services select on those
Not carried overnamed on stderr by path, by the table the Kubernetes API answers by: a field kith has nothing for (hostNetwork, an unknown kind, an object that would not validate), such as not translated: Deployment/web: spec.template.spec.hostNetwork not translated, and one taken that changes nothing (an affinity, most of a securityContext). Status, managedFields, uid, resourceVersion and Helm's own labels are ignored, not reported
Exit status0 everything translated, 1 something is in the report (the output is still printed), 2 the input could not be read

From a docker-compose file #

kith import compose docker-compose.yml --node n1 -n media prints the stack as kith resources, the same way: review, then kith apply -f it. It is a translation, once; kith does not run compose. kith's YAML has no anchors, merge keys or variables: docker compose config writes them out, and a value that still holds a $ is refused by name.

composekith
a servicea Workload with pod: true (a network of its own, as in compose) and one container
services joined by network_mode: service:NAMEcontainers of NAME's pod: they share localhost
ports, exposea Service of the compose name, and of container_name and each network alias, with the container's ports (TCP)
a directory (./config:/config), a named volumea Volume on the node --node names, and its mount (:ro carried)
environment, command, entrypoint, working_dir, userthe same fields of the container
restartrestartPolicy
healthcheck with curl or wget of an http address on localhosta readiness probe with its interval, timeout and retries
refused by path and name, as kith import k8s doesprivileged, cap_add, sysctls, devices (a DeviceClaim is how kith gives hardware), network_mode: host, env_file, tmpfs, a UDP port, a port published on the node's own address, a depends_on condition (kith waits for nothing: an app retries), two networks in one file (a namespace is one network), an absolute host path (kith takes one in kith-system only, and never /, /proc, /sys, /dev or a docker socket), two volumes that would make one name, and every key it does not know
a variable named like a secret (PASSWORD, TOKEN, KEY)carried and said: it is in the output as plain text, and a Secret with envFrom keeps it out of the Workload

From Docker containers #

For containers made with docker run (no compose file), as when moving off Docker Desktop: kith import docker web db --node n1 -n media runs docker inspect --type container web db (no shell) and reads what it says of each container as the compose service it is, so the table above holds as it is: the same Workloads, Services and Volumes, and the same refusals by path (services.web.privileged, services.web.cap_add[0], a bind mount as services.web.volumes[0] being an absolute host path). -f FILE reads a saved docker inspect instead, and -f - reads stdin; with no docker installed, pipe it: docker inspect web db | kith import docker -f -. The exit status is the same: 0, 1 when something was left out, 2 for input that could not be read.

What docker inspect says of a container's HostConfig that kith has no setting for is left out and said by path under compose's name for it, when it is not what docker fills in for nothing: mem_limit, memswap_limit, mem_reservation, cpus, cpu_shares, cpuset, blkio_config, pids_limit, shm_size, oom_kill_disable, runtime, cgroup_parent, pid, ipc and uts (other than private), userns_mode, group_add, volumes_from, gpus (DeviceRequests), ulimits, dns, dns_search, extra_hosts and tmpfs (--tmpfs). A volume name longer than 63 characters (an anonymous docker volume's is 64 hex) is cut to its start and a hash of the whole, so the Volume's name is one kith apply takes. With -n kith-system a bind mount is carried as the node's own host path, and a note: line says so: it is not a thing left out, and the exit status does not change.

The image reference is kept and kith pulls it: no image is moved. A bind mount is not copied. A container's labels, its image's Env, Cmd and Entrypoint are all in what docker inspect prints, and are carried or said like a compose service's.

Each named volume a Workload mounts also gets a line on stderr, to run after the printed resources are applied (a Volume must be there before files go in):

volume web-data: once applied, copy the docker volume's files in: docker run --rm -v web_data:/v:ro busybox tar -C /v -c . | kith volume put web-data - -n media

It is not done for you: kith does not read Docker Desktop's data directory or its VM. Stop the container first so the files are whole, and see Files in and out of a volume for what kith volume put takes.

Coming from Proxmox or docker compose #

A guest on a hypervisor is a whole system with one job. On kith the job is a Workload from the same image the guest would have run, its data a Volume, its name a Service; the system around it is kith OS. What each kind of guest becomes, and what is still missing:

A guest that isBecomesToday
a web app with one port and a data directory (a password manager, a search engine, an automation tool, a package repository)a Workload, a Volume, a Service with exposeworks
an app with its database and helpers beside it (a file cloud, a Git forge)one pod: the containers share localhost; a Volume eachworks; a port other than HTTPS (the forge's SSH) is a published port, on the pod's node only
a media server with a GPUa Workload with a DeviceClaim on the cardthe claim works; transcoding is not tried on a real card
a compose stackkith import compose FILE prints it as Workloads, Services and Volumes, and refuses by name what it cannot carryworks for what it carries
containers made with docker run (Docker Desktop)kith import docker NAME... reads docker inspect as the same Workloads, Services and Volumes, and prints the line that copies each named volume inworks for what it carries; the copy is a line you run
a reverse proxykith's own ingress: a Service's expose, a certificate by ACME or your ownby host name and by path, with headers set; no rewriting of paths, no login in front of an app, no HTTP/2 to a host read by path
a DNS filterkith's own DNS with a DNSBlockList: hosts files and filter lists' plain rulesworks; no per-client statistics or query log
a mail relay, or anything on a port of the LAN that is not HTTPSa pod whose port says publish: true, or a Workload that shares its node's network (root, not a pod)works; a published port is on one node, the first pod's there to ask for it
a VPN endpoint for people (phones, laptops)kith's own: kithd --people, an AccessLevel and kith peer add (Let a person's phone in)kith's own, built
an app that must go out through a VPNa Workload with an exit, its web UI a published portWireGuard; tested against a provider in a VM, not a real one
a VM with no image (an appliance)a vms unitoutbound network only, its disk not a Volume, not on kith OS: not yet

Moving a guest's data, one guest at a time:

  1. Stop the app in the guest, so its files are whole.
  2. Apply the Volume its Workload will mount (kith apply -f app.yaml; the Workload may wait with replicas: 0).
  3. From a machine that reaches both, send the directory: ssh GUEST tar -cf - -C /var/lib/app . | kith volume put app-data - (or kith volume put app-data ./a-copy). It says how many files went in and names any link it left out; see Files in and out of a volume for what it refuses.
  4. Start the Workload and look at the app. The files are its user's whatever they were in the guest. Keep the old guest stopped, not deleted, until the new one has run a week.

kith does not need the hypervisor gone first: a kith OS image boots as a guest (UEFI, virtio disk and network), the way to try it beside what runs today. It is tested in QEMU, not on Proxmox itself: see As a guest on Proxmox VE.

The docker command, against kith #

The Docker Engine API in front of kith, begun: kith docker serve [--listen PATH] makes a socket (docker.sock beside kithd's, mode 0600 from its first moment; a socket a dead run left is replaced, one in use is refused) and the docker command talks to it with DOCKER_HOST=unix://PATH. It is in the kith-remote build (cargo feature docker), not in the default kith or in kithd: nothing in the daemon changed. Against a kithd with signing: required it asks for the admin's passphrase once, before it serves (at a terminal, or one line on stdin), and refuses to start without it; it never asks in the middle of a call.

Today it answers docker version, docker info and these container calls, each under any /v1.40/ to /v1.47/ prefix (a client newer or older is told so with a 400, as dockerd does):

  • docker run -d --name NAME IMAGE CMD (create, then start), ps, ps -a, inspect, stop, start, restart, kill, rm -f and wait.
  • docker logs [-f] [--tail N] NAME: what the container wrote, its two outputs kept apart, and with -f what it writes after, until it stops. kithd keeps no times, so --timestamps, --since and --until are 501, and a container that is a stopped Workload (replicas: 0) has no logs for kithd to read (one that never started has none to show).
  • docker run IMAGE CMD without -d (and with -t): it prints the output as it comes and exits with the container's exit code. With -t the output is raw, as it is on a terminal.
  • docker exec [-i] [-t] NAME CMD, and docker exec -it NAME sh on a terminal: the command runs in the container's unit through kithd's exec connection, its input is what you type (with -i), the window size follows your terminal, and its exit code is the command's. Not carried: exec -d, --env, --workdir, --user and --privileged (each is 501, with the reason).

Stdin to a container's main process (docker run -i, docker attach with stdin) is refused with a 501 that says why: kithd starts the main process with no input and has no way to attach to it. Give a command its input with docker exec -i.

A container is a kith resource in the namespace docker, labelled kith.dev/docker=NAME, with the labels its create body gave kept as they are. kith delete removes it. A container with --restart always or unless-stopped is a Workload (replicas: 0 while created or stopped, 1 while running): kith get workload NAME -n docker shows it. One with no (the default, so a plain docker run -d) or on-failure is a Job while it runs: kith get job NAME -n docker shows it, and once stopped it is a Workload at replicas: 0 again, until docker start makes the Job anew. A name is at most 61 characters. Its ID is the SHA-256 of its namespace and name, the same on every run.

Refused with a 400 and a JSON message in Docker's shape: a name Docker or kith would not take; a security-changing HostConfig field (privileged, capAdd, securityOpt, devices, binds and mounts, host PID, IPC, UTS, user or cgroup namespaces, networkMode host or container:); and a name another resource in the store already has (a 409).

Answered 501 with a JSON message, never left waiting: ps with filters; port bindings; ulimits; --rm; memory, CPU and PID limits; DNS, extra hosts and links; a hostname, exposed ports, a health check and a stop signal; volumes, --tmpfs, --volumes-from, a read-only root and --runtime; other network modes; images; and any other call not listed above. A request body sent chunked is 501 too.