Coder Social home page Coder Social logo

k8s-wasm's Introduction

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

k8s-wasm's People

Contributors

dvob avatar kramnamez avatar codefromthecrypt avatar

Stargazers

John Andersen avatar Thomas Philipona avatar Lahiru Udayanga avatar genix avatar Koji Hisano avatar Felix Septem avatar Zikani Nyirenda Mwase avatar lin avatar  avatar

Watchers

 avatar lin avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.