diff --git a/roles/container-engine/containerd/templates/containerd.service.j2 b/roles/container-engine/containerd/templates/containerd.service.j2 index bc0121bfa..7527d5ac3 100644 --- a/roles/container-engine/containerd/templates/containerd.service.j2 +++ b/roles/container-engine/containerd/templates/containerd.service.j2 @@ -35,6 +35,7 @@ LimitNOFILE=infinity # Only systemd 226 and above support this version. TasksMax=infinity OOMScoreAdjust=-999 +# Set the cgroup slice of the service so that kube reserved takes effect {% if kube_reserved is defined and kube_reserved|bool %} Slice={{ kube_reserved_cgroups_for_service_slice }} {% endif %} diff --git a/roles/container-engine/cri-dockerd/templates/cri-dockerd.service.j2 b/roles/container-engine/cri-dockerd/templates/cri-dockerd.service.j2 index 078f66651..ec128150f 100644 --- a/roles/container-engine/cri-dockerd/templates/cri-dockerd.service.j2 +++ b/roles/container-engine/cri-dockerd/templates/cri-dockerd.service.j2 @@ -35,6 +35,10 @@ LimitCORE=infinity TasksMax=infinity Delegate=yes KillMode=process +# Set the cgroup slice of the service so that kube reserved takes effect +{% if kube_reserved is defined and kube_reserved|bool %} +Slice={{ kube_reserved_cgroups_for_service_slice }} +{% endif %} [Install] WantedBy=multi-user.target diff --git a/roles/container-engine/docker/templates/docker.service.j2 b/roles/container-engine/docker/templates/docker.service.j2 index fd1d06121..539c3a5c4 100644 --- a/roles/container-engine/docker/templates/docker.service.j2 +++ b/roles/container-engine/docker/templates/docker.service.j2 @@ -42,6 +42,10 @@ TimeoutStartSec=1min Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s +# Set the cgroup slice of the service so that kube reserved takes effect +{% if kube_reserved is defined and kube_reserved|bool %} +Slice={{ kube_reserved_cgroups_for_service_slice }} +{% endif %} [Install] WantedBy=multi-user.target