Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 2.78 KB

README.md

File metadata and controls

42 lines (32 loc) · 2.78 KB

Kubernetes API Access Extensions with WebAssembly

This repository documents an extension of the Kubernetes API server which allows using WebAssembly modules to perform/extend the following actions:

  • Authentication
  • Authorization
  • Admission (validating and mutating)

To implement this, I forked the Kubernetes source code and extended the API server accordingly: https://github.com/dvob/kubernetes/tree/wasm.

The extension is not intended for production use. It is a proof of concept to show how WebAssembly could be used to extend Kubernetes.

In the fork I created a new package pkg/wasm in which I implemented an Authenticator, Authorizer and AdmissionController. Most of the implementation lives in this new package. There are only a few changes in the pkg/kube-apiserver package to add command line options enabling the WASM Authenticator, Authorizer and AdmissionController.

To run the WebAssembly modules we use the Wazero runtime. Wazero has zero dependencies and does not rely on CGO. Hence, it can be easily integrated in a Go project without adding a ton of dependencies.

To pass data between our extension (host) and the WASM modules we make use of the capabilities of WASI (fd_read, fd_write). The module reads the input data from standard input and writes the result to standard output. See the Module specification for the full details on how data is passed between host and modules. For Admission the extension also supports to use Kubewarden policies which are not context aware.

See Build and test Kubernetes API server for a manual on how to build and test API server fork with the WASM extension.

See User Documentation for a full description on how to setup and configure the extended API server.

To implement your own modules see the Module Specification. If you want to use Rust to implement the modules you can use the k8s_wasi helper library.

Links Overview