xtruder / kubenix

Replaced by https://github.com/hall/kubenix
MIT License
300 stars 34 forks source link

[question] What does kubenix do? #21

Closed hansbogert closed 4 years ago

hansbogert commented 4 years ago

Coming from a kubernetes background and have little exposure to Nix, what would Kubenix do for me? The term 'resource builder' is not really evident to me.

pauldub commented 4 years ago

Kubenix is a nix library that allows to build kubernetes manifests using nix expressions. It allows building abstraction thanks to its module system and integrates with the nix ecosystem.

hansbogert commented 4 years ago

Would this be a means to deploy k8s nodes with immutable kubernetes images, e.g., a k8s master? In a way, would this be an alternative, or have overlap with the functionality of kubeadm? (I don't mean overlap in any negative way!, I'm just trying to figure out where this fits)

pauldub commented 4 years ago

No, kubenix allows to describe kubernetes resources such as Deployments, Ingresses, etc.

Althought nixos has support for setting up kubernetes: https://nixos.org/nixos/options.html#kubernetes

euank commented 4 years ago

I'll add my own "kubenix is like" since hopefully more explanations will help!

The things in the k8s ecosystem that kubenix is most like are the following:

  1. ksonnet / jsonnet Those tools are both concerned with generating k8s resources, such as deployments, but doing so in a language that allows importing libraries, reusing config snippets, etc
  2. skycfg This is stripe's answer to the same problem of generating k8s resources
  3. A bunch of other tools in this document (thanks brian grant!)

Kubenix is unusual in that it can also use nix's other features to do things like build docker images as well, which most of those other tools don't deal with.

One other thing that may help you would be to read through the example in the repo.

That shows a nix expression that can be evaluated into a kubectl-applyable kubernetes deployment.

One benefit of writing it in nix instead of in yaml directly is that nix is a much safer language (i.e. indentation doesn't matter), it has handy features like functions, the ability to import / reference things, variables, built-in string templating, etc.

hansbogert commented 4 years ago

Thank you for the answers, this clears up quite a few things. I was approaching this from the underlay/ infrastructure side.