Skip to content

Commit

Permalink
Use native containerd snapshotter for ZFS
Browse files Browse the repository at this point in the history
This is a workaround to allow microk8s to run on ZFS systems.
See issue: #401

Using the zfs snapshotter would be another option, but currently
it seems that the zfs snapshotter requires it's own dedicated filesystem
and is still missing features such as Usage().

containerd/zfs#17
  • Loading branch information
sevangelatos committed Mar 2, 2020
1 parent 830eb36 commit 04a5070
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion microk8s-resources/default-args/containerd-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ oom_score = 0
enable_tls_streaming = false
max_container_log_line_size = 16384
[plugins.cri.containerd]
snapshotter = "overlayfs"
snapshotter = "${SNAPSHOTTER}"
no_pivot = false
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
Expand Down
12 changes: 11 additions & 1 deletion microk8s-resources/wrappers/run-containerd-with-args
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ if [ -e "${SNAP_DATA}/var/lock/gpu" ]; then
else
RUNTIME="runc"
fi
sed 's@${SNAP}@'"${SNAP}"'@g;s@${SNAP_DATA}@'"${SNAP_DATA}"'@g;s@${RUNTIME}@'"${RUNTIME}"'@g' $SNAP_DATA/args/containerd-template.toml > $SNAP_DATA/args/containerd.toml

# Determine the underlying filesystem that containerd will be running on
FSTYPE=$(/usr/bin/stat -f -c %T "${SNAP_COMMON}")
# ZFS is supported throught the native snapshotter
if [ "$FSTYPE" = "zfs" ]; then
SNAPSHOTTER="native"
else
SNAPSHOTTER="overlayfs"
fi

sed 's@${SNAP}@'"${SNAP}"'@g;s@${SNAP_DATA}@'"${SNAP_DATA}"'@g;s@${SNAPSHOTTER}@'"${SNAPSHOTTER}"'@g;s@${RUNTIME}@'"${RUNTIME}"'@g' $SNAP_DATA/args/containerd-template.toml > $SNAP_DATA/args/containerd.toml

run_flanneld="$(is_service_expected_to_start flanneld)"
if [ "${run_flanneld}" == "1" ]
Expand Down

0 comments on commit 04a5070

Please sign in to comment.