mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-11 23:50:06 +01:00
Kubernetes management with Nix
https://kubenix.org/
| .github/workflows | ||
| .vscode | ||
| docs | ||
| jobs | ||
| lib | ||
| modules | ||
| pkgs | ||
| tests | ||
| .envrc | ||
| .gitignore | ||
| .gitmodules | ||
| CONTRIBUTING.md | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
| treefmt.toml | ||
| versions.nix | ||
kubenix
Kubernetes management with Nix
WARN: this is a work in progress, expect breaking changes
Usage
A minimal example flake.nix (build with nix build):
{
inputs.kubenix.url = "github:hall/kubenix";
outputs = {self, kubenix, ... }@inputs: let
system = "x86_64-linux";
in {
packages.${system}.default = (kubenix.evalModules.${system} {
module = { kubenix, ... }: {
imports = with kubenix.modules; [k8s];
kubernetes.resources.pods.example.spec.containers.nginx.image = "nginx";
};
}).config.kubernetes.result;
};
}
Or, if you're not using flakes, a default.nix file (build with nix-build):
{ kubenix ? import (builtins.fetchGit {
url = "https://github.com/hall/kubenix.git";
rev = "aa734afc9cf7a5146a7a9d93fd534e81572c8122";
}) }:
(kubenix.evalModules.x86_64-linux {
module = {kubenix, ... }: {
imports = with kubenix.modules; [k8s];
kubernetes.resources.pods.example.spec.containers.nginx.image = "nginx";
};
}).config.kubernetes.result
Either way the JSON manifests will be written to ./result.
See the examples for more.
CLI
NOTE: this is a WIP CLI which currently reads the
kubenixpackage on a local flake
Render all resources with
nix run github:hall/kubenix -- render
HINT: use
--helpfor more commands
Support
The following table gives a general overview of currently supported/planned functionality.
| kubectl | helm | |
|---|---|---|
| render | x | x1 |
| diff | x | x |
| apply2 | x | x |
Attribution
This project was forked from GTrunSec, which was forked from xtruder, with commits incorporated from blaggacao.
Logo is a mishmash of the Kubernetes wheel and the NixOs snowflake.