Welcome

Kerbi: Kubernetes Templating and State Management

codecov Gem Version License: MIT

Kerbi is a Kubernetes tool most similar to Helm, with the following key differences:

  • Templating: also variable-based, but aspires to be more powerful, flexible, and delightful

  • State mgmt: aspires to be less invasive, more deliberate, explict, and transparent

  • Revision mgmt: publishing makes your templating logic invokable over HTTP/JSON (W.I.P)

DocsRepo

Getting Started

Install the kerbi RubyGem globally:

$ gem install kerbi

Now use the new kerbi executable to initialize a project and install the dependencies:

$ kerbi project new hello-kerbi
$ cd hello-kerbi

Voila. You can now generate templates and manage state:

$ kerbi template demo . --set message=special
text: special demo message

Documentation.

At a Glance

💲 Variable based like Helm

Like Helm, your templating logic depends on key-value pairs (aka variables) you pass in at runtime. Your have a baseline values.yaml file and then three possible sources of extra variables:

  • override files, e.g-f production.yaml,

  • inline assignments, e.g --set backend.ingress.enabled=false,

  • previously committed values, e.g --read-state @latest via state management (covered later)

📜 Basic Templating with YAML embedded with Ruby

Kerbi lets you do your basic templating with Ruby embedded YAML (ERB), keeping your template files readable to all and singularly focused, while your more complex logic goes in Mixers shown in the following section.

deployment.yaml.erb

🚦 Powerful Higher Order Templating Model

Mixers give you control and organization. Inside your Mixer subclasses, you can explicitly load up your lower level template files (like deployment.yaml.erb above), other mixers, entire directories, or even raw Helm charts. Loader functions like file() and dir() return a sanitized Array<Hash>, making it easy to filter, patch, or modify output.

backend/mixer.rb

📀 Explicit & Non Invasive State Management

Kerbi lets you persist and retreive the bundles of the variables you generate your manifests with to a ConfigMap or Secret. Unlike Helm, which couples state with a heavy handed concept of "releases" (that annotates your resources, kubectl's for you, etc...), Kerbi opts for a simple, deliberate, and non-invasive API: --read-state and --write-state.

our-cd-pipeline.sh

List states for the tuna release:

List all releases:

⌨️ Interactive Console

My favorite thing about CDK8s is that it feels like a normal computer program. Kerbi takes that one step further by letting you run your code in interactive mode (via IRB), making it easy to play with your code or the Kerbi lib.

Getting Involved

CONTRIBUTING.md

Email: xavier@nmachine.io

Discord: https://discord.gg/ntAs6TaD

Running the Examples

Have a look at the examples directory. If you want to go a step further and run them from source, clone the project, cd into the example you want. For instance:

Last updated