services.k3s.manifests
lets you configure kubernetes manifests in your Nix config. It converts the manifests to YAML and applies them in a manner similar tokubectl apply
. For example, you can create a namespace with the following config
services.k3s.manifests = {
test-ns.content = {
apiVersion = "v1";
kind = "Namespace";
metadata.name = "test";
};
};
If nothing happens for you, search for the manifest name (test-ns
in the example above) in the k3s logs (journalctl -u k3s
). It will show you if there is a problem with the manifest.
services.k3s.charts
isn’t useful on its own, it just makes charts accessible from inside the cluster.services.k3s.autoDeployCharts
can be used to actually deploy Helm charts in the cluster. It is a new option that is only available on unstable (added in nixos/k3s: add `autoDeployCharts` option · NixOS/nixpkgs@95b894b · GitHub). Use this to install flux via the Helm chart in your cluster.
There is also a post that explains how to use these options: K3s clusters and deployments in pure Nix