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

Adding system oom events from kubelet #6718

Merged
merged 3 commits into from
Apr 29, 2015
Merged

Conversation

vishh
Copy link
Contributor

@vishh vishh commented Apr 11, 2015

Kubelet will surface the most recent system OOM as events.

Status: Unit tests pending; System test pending

for #2853

@vishh vishh added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Apr 11, 2015
@vishh
Copy link
Contributor Author

vishh commented Apr 11, 2015

cc @dchen1107 @vmarmol

@vishh vishh force-pushed the sys_oom1 branch 2 times, most recently from 60e63b3 to e25ae66 Compare April 11, 2015 00:34
@dchen1107 dchen1107 self-assigned this Apr 13, 2015
@@ -1776,6 +1777,51 @@ func (kl *Kubelet) recordNodeOnlineEvent() {
kl.recorder.Eventf(kl.nodeRef, "online", "Node %s is now online", kl.hostname)
}

// Returns the most recent sys oom event from cadvisor.
// Returns nil if no sys oom events were observed.
func (kl *Kubelet) getRecentSysOOMEvent() (*cadvisorApi.OomEventData, util.Time, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT of putting this in the cAdvisor subpackage and exposing a "RecentSysOOMEvent()". Trying to minimize code in kubelet.go :)

@erictune
Copy link
Member

Is something going to actuate off this NodeCondition, or is it just to aid debugging?
Also, isn't an OOM a transient event rather than a state?
Based on those two things, seems like an event more appropriate than a Condition?

@vishh
Copy link
Contributor Author

vishh commented Apr 14, 2015

The OOM is a transient event. We will have monitoring systems alerting on
Node State, and an event is not suitable for such purposes!

On Tue, Apr 14, 2015 at 10:08 AM, Eric Tune notifications@github.com
wrote:

Is something going to actuate off this NodeCondition, or is it just to aid
debugging?

Also, isn't an OOM a transient event rather than a state?

Based on those two things, seems like an event more appropriate than a
Condition?


Reply to this email directly or view it on GitHub
#6718 (comment)
.

@erictune
Copy link
Member

Turning an event into a state seems like the wrong way to model this. Better for monitoring to monitor the count of OOM events and alert on an excessive rate of events over a period. There may be multiple alerts for different rates and periods, and different groupings (single-node, cluster-wide). Faking this as a state would just confuse that.

@dchen1107
Copy link
Member

I agree with @erictune. I think what we really need is filtering those OOM events to figure out why a running container is killed and provided proper ContainerStatus. NodeCondition is changed at the moment when OOM is detected.

@erictune
Copy link
Member

We should have both node and pod events. If a pod is killed due to OOM,
and we can determine the cause, then we report a pod event.
Additionally we report a node event for admins to monitor overall cluster
rate of OOMs, problematic nodes, to aid debugging in cases when OOM cannot
be matched to Pod, and to help debugging in cases where OOM causes
collateral damage to non-killed pods (which we have seen many times
internally).

On Tue, Apr 14, 2015 at 10:38 AM, Dawn Chen notifications@github.com
wrote:

I agree with @erictune https://github.com/erictune. I think what we
really need is filtering those OOM events to figure out why a running
container is killed and provided proper ContainerStatus. NodeCondition is
changed at the moment when OOM is detected.


Reply to this email directly or view it on GitHub
#6718 (comment)
.

@vishh vishh force-pushed the sys_oom1 branch 2 times, most recently from c413141 to 229e3de Compare April 21, 2015 23:09
@vishh
Copy link
Contributor Author

vishh commented Apr 21, 2015

@dchen1107: I have updated the PR to generate events. Testing is still missing. If the general outline of the PR works, I will add the tests.

@vishh vishh changed the title WIP: Adding System OOM node condition Adding system oom events from kubelet Apr 21, 2015
@vmarmol
Copy link
Contributor

vmarmol commented Apr 22, 2015

Only downside to the watch approach we do today is that we'll miss OOM events from when we are down. This is probably okay initially. We should be able to fill in the gap when we come back up.

@vishh
Copy link
Contributor Author

vishh commented Apr 22, 2015

Yup. I would argue that we should not let the kubelet go down for too long
:) The alternative will demand checkpoints.

On Wed, Apr 22, 2015 at 9:41 AM, Victor Marmol notifications@github.com
wrote:

Only downside to the watch approach we do today is that we'll miss OOM
events from when we are down. This is probably okay initially. We should be
able to fill in the gap when we come back up.


Reply to this email directly or view it on GitHub
#6718 (comment)
.

@vishh
Copy link
Contributor Author

vishh commented Apr 22, 2015

@vmarmol: I added an unit test. The cadvisor API needs to be enhanced a bit to make the unit test useful. PTAL!

@@ -558,10 +561,25 @@ func (kl *Kubelet) Run(updates <-chan PodUpdate) {
}

go kl.syncNodeStatus()
// Run the system oom watcher forever.
util.Until(kl.runOOMWatcher, time.Microsecond, util.NeverStop)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use util.Forever() (which uses Until under the covers, but makes it clear)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

util.Forever is marked as being deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Whaaaaa? First I hear of it, thanks for the heads up :)

@vmarmol
Copy link
Contributor

vmarmol commented Apr 23, 2015

Huh, the integration test is failing with the error we were seeing yesterday. Were you able to find the cause?

@vishh
Copy link
Contributor Author

vishh commented Apr 23, 2015

@vmarmol: The integration tests are failing because the kubelet is not able to get node information. I will fix that and update the PR. Meanwhile, lets iron out the rest of the code.

@vishh
Copy link
Contributor Author

vishh commented Apr 23, 2015

Not yet.

On Thu, Apr 23, 2015 at 8:52 AM, Victor Marmol notifications@github.com
wrote:

Huh, the integration test is failing with the error we were seeing
yesterday. Were you able to find the cause?


Reply to this email directly or view it on GitHub
#6718 (comment)
.

@vmarmol
Copy link
Contributor

vmarmol commented Apr 23, 2015

Thanks @vish!

@vishh
Copy link
Contributor Author

vishh commented Apr 28, 2015

@vmarmol: This PR is safe to be merged now. I am tackling the node events issue via a separate PR.

@@ -543,7 +546,9 @@ func (kl *Kubelet) GetNode() (*api.Node, error) {
return nil, errors.New("cannot list nodes")
}
host := kl.GetHostname()
glog.V(2).Infof("hostname: %q", host)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove these two debug lines? If you want to keep the hostname one can we make it V(4)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@vishh vishh force-pushed the sys_oom1 branch 2 times, most recently from d684531 to ecab94a Compare April 28, 2015 16:33
@vishh
Copy link
Contributor Author

vishh commented Apr 28, 2015

PTAL @vmarmol

@@ -52,6 +52,6 @@ func (c *Fake) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
return cadvisorApiV2.FsInfo{}, nil
}

func (c *Fake) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
return []*cadvisorApi.Event{}, nil
func (self *Fake) WatchEvents(request *events.Request) (*events.EventChannel, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/self/c/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@vishh vishh force-pushed the sys_oom1 branch 2 times, most recently from 553d0a8 to 7e989b4 Compare April 28, 2015 16:47
@@ -543,6 +546,7 @@ func (kl *Kubelet) GetNode() (*api.Node, error) {
}
host := kl.GetHostname()
for _, n := range l.Items {
glog.V(2).Info(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

@vishh vishh force-pushed the sys_oom1 branch 2 times, most recently from 63c32b2 to 2ff6a95 Compare April 28, 2015 16:51
@vmarmol
Copy link
Contributor

vmarmol commented Apr 28, 2015

LGTM, thanks @vishh! Will wait for green.

@vishh
Copy link
Contributor Author

vishh commented Apr 28, 2015

I apologize for the slipping in useless log lines. Thanks for the thorough review @vmarmol

@vmarmol
Copy link
Contributor

vmarmol commented Apr 28, 2015

No worries :D thanks for the quick fixes!

@vmarmol
Copy link
Contributor

vmarmol commented Apr 28, 2015

@vishh the integration test failed (again) can you take a look? I don't think it's a flake since it's failed twice now.

Kubelet will continuously watch for system OOMs and generate events whenever it
encounters a system OOM.
@vishh
Copy link
Contributor Author

vishh commented Apr 29, 2015

@vmarmol: The integration tests did catch a bug :) I updated the PR and it should pass this time around.

vmarmol added a commit that referenced this pull request Apr 29, 2015
Adding system oom events from kubelet
@vmarmol vmarmol merged commit 209b4fc into kubernetes:master Apr 29, 2015
cadvisorApi.EventOom: true,
},
ContainerName: "/",
IncludeSubcontainers: false,
Copy link
Member

@andyxning andyxning Nov 19, 2016

Choose a reason for hiding this comment

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

Seems this option, IncludeSubcontainers, should be opened, otherwise i am afraid we can not query cadvisor with correct result. As all containers are under the root container and we should include all descendants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants