nix-to-kubernetes icon indicating copy to clipboard operation
nix-to-kubernetes copied to clipboard

An example of deploying Nix-built Docker images to Kubernetes.Not act

Nix to Kubernetes

This repo provides an example of integrating Nix into a DevOps deployment pipeline. The scenario:

This repo was created in conjunction with Deploying Nix-built containers to Kubernetes, which is published on our blog.

Moving parts

  • Go web service
  • Terraform config
  • Terraform variable definitions and variable values
  • Kubernetes Deployment config
  • A Nix flake defines the development environment and package/app outputs
  • Nix-defined continous integration logic
  • GitHub Actions pipeline. Note: the deploy job in the Actions pipeline is expected to fail, as it assumes that the Kubernetes cluster is currently running. We're gonna go ahead and save costs (and electricity) by terraform destroying the cluster when we're not using it 😀

GitHub Container Registry stores Docker images built by Nix.

Developing this scenario

See DEVELOPMENT.md for instructions on standing up the infrastructure and interacting with the Kubernetes cluster.