Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

[question] What does kubenix do? #21

Closed
hansbogert opened this issue May 11, 2020 · 5 comments
Closed

[question] What does kubenix do? #21

hansbogert opened this issue May 11, 2020 · 5 comments

Comments

@hansbogert
Copy link

hansbogert commented May 11, 2020

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.

@hansbogert hansbogert changed the title [question] What does kubenix do [question] What does kubenix do? May 11, 2020
@pauldub
Copy link

pauldub commented May 11, 2020

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
Copy link
Author

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
Copy link

pauldub commented May 11, 2020

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
Copy link

euank commented May 15, 2020

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
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants