Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a systemd override to add containerd defaults #932

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading