nix-kubernetes
Kubernetes deployment manager written in nix
About
Nix-kubernetes is deployment manager for kubernetes that users nixos module system to do declarative kubernetes configuration and deployment. By combining nix package manager and nix-kubernetes declarative cluster configuration it can do fully deterministic deployments from packages to configuration.
Depencies
- nix (for installation instructions go to https://nixos.org/nix/)
Installation
$ nix-env -f https://github.com/xtruder/nix-kubernetes/archive/v0.25.1.tar.gz -iA package
Usage
Usage: bin/nix-kubernetes <command> [options] Commands: create <file> Create deployment list List all known deployments delete Delete deployment describe Describes deployment deploy Deploy configuration config Manage deployment run-job <name> Run distributed kubernetes job gc Garbage collect resources Options: -c, --config path to configuration file [default: "~/.kube/nix-kubernetes.json"] -h, --help Show help [boolean] Examples: bin/nix-kubernetes create -d name deploy.nix create deployment bin/nix-kubernetes deploy -d name -n namespace --context my-cluster deploy resources bin/nix-kubernetes deploy -d name --build-only only build
Deploy
nix-kubernetes deploy Options: -c, --config path to configuration file [default: "~/.kube/nix-kubernetes.json"] -h, --help Show help [boolean] -f, --file Use prebuild deployment file -d, --deployment Deployment name -n, --namespace Namespace to deploy -i, --include Resources to include in deployment -o, --output Output generated config to file --context Kubernetes config context to use
Example usage
$ nix-kubernetes create -d gatehub deploy.nix$ export NIX_PATH="services=/home/offlinehacker/projects/x-truder.net/services:$NIX_PATH"$ nix-kubernetes deploy -d gatehub --build-only$ nix-kubernetes deploy -d gatehub -n namespace --context my-cluster --gc
Example deployment configurations
look into examples folder with example deployment configurations.
Options
For a list of all options look into options.md
Nix-kubernetes services
Repo with bundle of nix-kubernetes services is avalible on https://github.com/x-truder/services.
Development
Use development version
$ npm link$ export PATH=~/.npm/bin:$PATH
Build deployments
$ nix-build -A staging --arg configuration deploy.nix
License
MIT © Jaka Hudoklin