From 62092edbd177b401a818cc62d187dff1d5ffded3 Mon Sep 17 00:00:00 2001 From: jcstryker Date: Wed, 3 Sep 2025 17:48:44 -0400 Subject: [PATCH] docs: updated zfs snapshotter support for k3s --- .../cluster/k3s/docs/examples/STORAGE.md | 44 +++++++------------ 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/pkgs/applications/networking/cluster/k3s/docs/examples/STORAGE.md b/pkgs/applications/networking/cluster/k3s/docs/examples/STORAGE.md index fc9a6440ff9a..f61a13eee01d 100644 --- a/pkgs/applications/networking/cluster/k3s/docs/examples/STORAGE.md +++ b/pkgs/applications/networking/cluster/k3s/docs/examples/STORAGE.md @@ -87,36 +87,22 @@ In order to support Rook/Ceph, the following NixOS kernelModule configuration is boot.kernelModules = [ "rbd" ]; ``` -## ZFS Snapshot Support +## ZFS ContainerD Support -K3s's builtin containerd does not support the zfs snapshotter. However, it is possible to configure it to use an external containerd: +The [ZFS snapshotter](https://github.com/containerd/zfs) can be enabled for k3s' embedded ContainerD though it requires mounting a dataset to a specific path used by k3s: `/var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.zfs` + +For example: + +```bash +$ zfs create -o mountpoint=/var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.zfs /containerd +``` + +You can now configure k3s to use zfs by passing the `--snapshotter` flag. ``` -virtualisation.containerd = { - enable = true; - settings = - let - fullCNIPlugins = pkgs.buildEnv { - name = "full-cni"; - paths = with pkgs;[ - cni-plugins - cni-plugin-flannel - ]; - }; - in { - plugins."io.containerd.grpc.v1.cri".cni = { - bin_dir = "${fullCNIPlugins}/bin"; - conf_dir = "/var/lib/rancher/k3s/agent/etc/cni/net.d/"; - }; - # Optionally set private registry credentials here instead of using /etc/rancher/k3s/registries.yaml - # plugins."io.containerd.grpc.v1.cri".registry.configs."registry.example.com".auth = { - # username = ""; - # password = ""; - # }; - }; -}; -# TODO describe how to enable zfs snapshotter in containerd -services.k3s.extraFlags = toString [ - "--container-runtime-endpoint unix:///run/containerd/containerd.sock" -]; +services.k3s = { + ... + extraFlags = [ + "--snapshotter=zfs" + ]; ```