Skip to content

Commit

Permalink
Enable CPU and Memory accounting for systemd services by default when…
Browse files Browse the repository at this point in the history
… building from local sources.

For distribution packages (rpms, deb, etc.) let the installation mechanism to take care of accounting.

Quoting:
Fix system container detection in kubelet on systemd.

This fixed environments where CPU and Memory Accounting were not enabled on the unit
that launched the kubelet or docker from reporting the root cgroup when
monitoring usage stats for those components.

From: kubernetes/kubernetes#25982
  • Loading branch information
ingvagabund committed May 25, 2016
1 parent 3634e30 commit 451175d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ansible/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
tags:
- etcd

# Install docker
- hosts: all
sudo: yes
roles:
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/common/files/kubernetes-accounting.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Manager]
DefaultCPUAccounting=yes
DefaultMemoryAccounting=yes
11 changes: 11 additions & 0 deletions ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@

- include: fedora-install.yml
when: not is_atomic and ansible_distribution == "Fedora"

# enable cpu and memory accounting for systemd services by default
- name: Create systemd dropin directory
file: path=/etc/systemd/system/system.conf.d state=directory mode=0755
when: source_type == "localBuild"

- name: Enable cpu and memory accounting for systemd services
copy: src=kubernetes-accounting.conf dest="/etc/systemd/system/system.conf.d/kubernetes-accounting.conf"
when: source_type == "localBuild"
notify:
- reload systemd

0 comments on commit 451175d

Please sign in to comment.