This project is highly experimental. It is just a proof of concept, and you should not use it in production.
Krustlet acts as a Kubelet by listening on the event stream for new pod requests that match a particular set of node selectors.
The default implementation of Krustlet listens for the architecture wasm32-wasi and schedules those workloads to run in a wasmtime-based runtime instead of a container runtime.
We recommend using just to build. But you can just use cargo if you want:
$ just build
$ cargo buildBuilding a Docker image is easy, too:
$ just dockerizeThat will take a LOOONG time the first build, but the layer cache will make it much faster from then on.
Again, we recommend just, but you can use cargo:
$ just run
$ cargo runNote that if you are not running the binary in your cluster (e.g. if you are instead running it locally), then the log and exec calls will result in errors.
The krustlet listens for wasm32-wasi architecture:
apiVersion: v1
kind: Pod
metadata:
name: greet
spec:
containers:
- image: technosophos/greet
imagePullPolicy: Always
name: greet
nodeSelector:
kubernetes.io/role: agent
beta.kubernetes.io/os: linux
beta.kubernetes.io/arch: wasm32-wasiNote that the nodeSelector is the important part above, though image is expected to point to a WASM module as well.
To load the above into Kubernetes, use kubectl apply -f greet.yaml. You should see the pod go into the Running state very quickly. If the WASM is not daemonized, it should go to the Succeeded phase soon thereafter.
If you want to create your own Kubelet based on Krustlet, all you need to do is implement a Provider. See the src/main.rs to get started.