Merge pull request #704 from Random-Liu/use-systemd

Use systemd service cgroup and oom score adj.
This commit is contained in:
Lantao Liu 2018-03-28 14:53:24 -07:00 committed by GitHub
commit 71c8b6b9e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 28 deletions

View File

@ -30,12 +30,6 @@ write_files:
permissions: 0644
owner: root
content: |
# installed by cloud-init
oom_score = -999
[cgroup]
path = "/runtime"
[plugins.linux]
shim = "/home/containerd/usr/local/bin/containerd-shim"
runtime = "/home/containerd/usr/local/sbin/runc"
@ -61,6 +55,7 @@ write_files:
RestartSec=5
Delegate=yes
KillMode=process
OOMScoreAdjust=-999
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.

View File

@ -28,12 +28,6 @@ write_files:
permissions: 0644
owner: root
content: |
# installed by cloud-init
oom_score = -999
[cgroup]
path = "/runtime"
[plugins.linux]
shim = "/home/containerd/usr/local/bin/containerd-shim"
runtime = "/home/containerd/usr/local/sbin/runc"
@ -59,6 +53,7 @@ write_files:
RestartSec=5
Delegate=yes
KillMode=process
OOMScoreAdjust=-999
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.

View File

@ -15,5 +15,5 @@ export KUBE_CONTAINER_RUNTIME_ENDPOINT="/run/containerd/containerd.sock"
export KUBE_LOAD_IMAGE_COMMAND="/home/containerd/usr/local/bin/ctr cri load"
export NETWORK_POLICY_PROVIDER="calico"
export NON_MASQUERADE_CIDR="0.0.0.0/0"
export KUBE_KUBELET_EXTRA_ARGS="--runtime-cgroups=/runtime"
export KUBE_KUBELET_EXTRA_ARGS="--runtime-cgroups=/system.slice/containerd.service"
export KUBE_FEATURE_GATES="ExperimentalCriticalPodAnnotation=true,CRIContainerLogRotation=true"

View File

@ -13,14 +13,6 @@
- name: "Create a directory for containerd config"
file: path=/etc/containerd state=directory
- name: "Add containerd config file"
blockinfile:
path: /etc/containerd/config.toml
create: yes
block: |
[cgroup]
path = "/runtime"
- name: "Start Containerd"
systemd: name=containerd daemon_reload=yes state=started enabled=yes
@ -46,7 +38,7 @@
- name: "Add runtime args in kubelet conf"
lineinfile:
dest: "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf"
line: "Environment=\"KUBELET_EXTRA_ARGS= --runtime-cgroups=/runtime --container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=/run/containerd/containerd.sock\""
line: "Environment=\"KUBELET_EXTRA_ARGS= --runtime-cgroups=/system.slice/containerd.service --container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=/run/containerd/containerd.sock\""
insertafter: '\[Service\]'
when: check_args.stdout == ""

View File

@ -27,12 +27,6 @@ write_files:
permissions: 0644
owner: root
content: |
# installed by cloud-init
oom_score = -999
[cgroup]
path = "/runtime"
[plugins.linux]
shim = "/home/containerd/usr/local/bin/containerd-shim"
runtime = "/home/containerd/usr/local/sbin/runc"
@ -58,6 +52,7 @@ write_files:
RestartSec=5
Delegate=yes
KillMode=process
OOMScoreAdjust=-999
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.