Skip to content

Commit

Permalink
Add a systemd override to add containerd defaults (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayoz authored Jan 9, 2025
1 parent bb10a1c commit cf3bb9b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions k8s/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,16 @@ k8s::util::load_kernel_modules() {

modprobe $@
}

k8s::containerd::ensure_systemd_defaults() {
k8s::common::setup_env

local override_dir="/etc/systemd/system/snap.k8s.containerd.service.d"
local override_file="$SNAP/k8s/systemd/containerd-defaults.conf"

if ! [ -f "$override_dir/containerd-defaults.conf" ]; then
mkdir -p "$override_dir"
cp "$override_file" "$override_dir/"
fi

}
11 changes: 11 additions & 0 deletions k8s/systemd/containerd-defaults.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Service]
Delegate=yes
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
2 changes: 2 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
k8s::common::setup_env

k8s::cmd::k8s x-snapd-config reconcile

k8s::containerd::ensure_systemd_defaults

0 comments on commit cf3bb9b

Please sign in to comment.