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

Fix system container detection in kubelet on systemd #25982

Merged
merged 1 commit into from
May 28, 2016

Conversation

derekwaynecarr
Copy link
Member

@derekwaynecarr derekwaynecarr commented May 20, 2016

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.

Fixes #25909

/cc @kubernetes/sig-node @kubernetes/rh-cluster-infra @vishh @dchen1107

@derekwaynecarr derekwaynecarr added this to the v1.3 milestone May 20, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels May 20, 2016
@derekwaynecarr
Copy link
Member Author

If we are running e2e on systems with systemd, this could cause those systems to NOT report system container stats for kubelet or runtime unless they are launched from units with accounting enabled, or accounting is on by default in /etc/systemd/system.conf.

@pmorie @ingvagabund -- can you update the RHEL CI environment?

$ cat /etc/systemd/system.conf
...
DefaultCPUAccounting=true
DefaultMemoryAccounting=true
...

@vishh vishh assigned vishh and unassigned yujuhong May 20, 2016
@derekwaynecarr derekwaynecarr added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels May 20, 2016
@ingvagabund
Copy link
Contributor

$ cat /etc/systemd/system.conf
...
DefaultCPUAccounting=true
DefaultMemoryAccounting=true
...

This is suitable for ansible playbook so all can benefit from it. Do you think it should be enabled by default?

// in addition, you would not get memory or cpu accounting for the runtime unless accounting was enabled on its unit (or globally).
if systemd, found := cgs["name=systemd"]; found {
if systemd != cpu {
glog.Warningf("CPUAccounting not enabled for pid: %d", pid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we require cpu and memory accounting to be enabled for kube daemons by default?

@vishh
Copy link
Contributor

vishh commented May 20, 2016

@derekwaynecarr This PR LGTM. For the future though, can we require cpu and memory accounting to be enabled by default?

@derekwaynecarr
Copy link
Member Author

I wasn't sure everyone knew what to do when hacking on their local host. Was worried it would cause people problems. Ideas?

@derekwaynecarr
Copy link
Member Author

Basically they need to turn global accounting on when they hack from a Linux host since most people don't have accounting on in user sessions.

@vishh
Copy link
Contributor

vishh commented May 20, 2016

@derekwaynecarr May be a flag to allow kubelet to run without stats? In any case, this PR is fine as-is. So I will add the LGTM label.

@vishh vishh added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 20, 2016
@vishh
Copy link
Contributor

vishh commented May 20, 2016

@derekwaynecarr Another option is to just validate metrics requirement as part of conformance testing and not change kubelet.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 23, 2016
@derekwaynecarr derekwaynecarr added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 23, 2016
@derekwaynecarr
Copy link
Member Author

The node e2e boxes that run systemd (in this case it looks like coreos stable), we need to enable cpu and memory accounting by default. Will send a PR that does the same for vagrant as an example.

ingvagabund added a commit to ingvagabund/contrib that referenced this pull request May 25, 2016
… 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
@alex-mohr
Copy link
Contributor

fyi, required node test is failing.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented May 28, 2016

GCE e2e build/test passed for commit 5a8851d.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c730198 into kubernetes:master May 28, 2016
@wojtek-t
Copy link
Member

It seems that this PR broke node-e2e suite. Since this is blocking merge-queue, I'm going to revert this.
@k8s-oncall FYI

@derekwaynecarr
Copy link
Member Author

This should not have been merged until the node e2e infrastructure was updated per:

#26198

I will re-open, but merge bot should not have merged this.

@ingvagabund
Copy link
Contributor

@derekwaynecarr it should be enough to prefix the summary with [WIP] i believe to avoid merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubelet container manager cgroup detection should error if cpu and memory differ
9 participants