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

ReplicationController + crashlooping or invalid docker image = bad times #2529

Closed
lavalamp opened this issue Nov 21, 2014 · 13 comments
Closed
Labels
area/usability priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@lavalamp
Copy link
Member

ReplicationController has no idea when the pods it is making will deterministicly fail. This can rapidly fill your cluster with pod objects.

Mitigation: throttle the rate at which rep. ctlrs. can make new pods.

Real fix? Make replication controller watch events & stop after N tries failed without any successes?

@bgrant0607
Copy link
Member

See also #941 -- Kubelet has the same problem at the container level.

I'll leave this open to address my comment on #2491 -- gracefully handle pods that don't schedule.

@lavalamp
Copy link
Member Author

To fix your cluster, not that anyone has ever done this:

cluster/kubectl.sh get --output=template --template="{{range .items}}{{.id}}{{\"\n\"}}{{end}}" pods | xargs -l1 cluster/kubectl.sh delete pod

@goltermann goltermann added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Nov 26, 2014
@rawlingsj
Copy link

I've been caught out by this recently too. Having configuration for max number of tries on a replication controller would be great.

@davidopp
Copy link
Member

I am confused about this issue. IIUC replication controller only works with pods that specify RestartPolicy = Always. So wouldn't a fix for this (limit # retries, or rate limit retries) need to go into the Kubelet (or whatever is restarting the container -- is it Docker or the Kubelet)? I don't see how replication controller can help. It seems replication controller would only get involved if the pod needs to move off of that machine, but that doesn't seem like the case you're talking about here.

@lavalamp
Copy link
Member Author

@davidopp The problem is in how we report the pod's status; we report it as "failed" when kubelet is actually in the process of restarting it. This causes rep. ctrlr to make more pods, instead of waiting. So the bug here is in the assignment of status. Er, condition. Whatever we're calling it these days.

@bgrant0607
Copy link
Member

ReplicationController shouldn't stop permanently, it should back off. It can be very hard to distinguish temporary from permanent failures, and we don't want users to need to create replication controller controllers. The same applies for Kubelet.

We should find a way to facilitate implementation of more sophisticated policies by users.

@lavalamp
Copy link
Member Author

lavalamp commented Jan 7, 2015

To recap.

While kubelet is restarting a pod, apiserver will list its status as "Failed", which will cause replication controller to make additional pods.

Action item here is to make apiserver give a reasonable amount of time (forever?) to kubelet to perform as many restarts as it wants, and during that time the pod should count as Running (if it ever ran) or Pending (if it never successfully started).

@lavalamp
Copy link
Member Author

lavalamp commented Jan 7, 2015

(Eventually we want to push pod status generation down into kubelet but I think it's worthwhile making this intermediate fix because this really hoses your cluster when it happens to you.)

@thockin
Copy link
Member

thockin commented Jan 7, 2015

I don't think it is about "reasonable amount of time" but having enough
information to make the correct observation.

On Tue, Jan 6, 2015 at 4:40 PM, Daniel Smith notifications@github.com
wrote:

To recap.

While kubelet is restarting a pod, apiserver will list its status as
"Failed", which will cause replication controller to make additional pods.

Action item here is to make apiserver give a reasonable amount of time
(forever?) to kubelet to perform as many restarts as it wants, and during
that time the pod should count as Running (if it ever ran) or Pending (if
it never successfully started).

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

@dchen1107
Copy link
Member

@lavalamp #2999 was merged a while back, and with that change, now PodCondition / PodStatus are determined by both ContainerStatus and RestartPolicy.

@lavalamp
Copy link
Member Author

lavalamp commented Jan 7, 2015

Dawn is right, this bug seems to be fixed and should probably be closed.

@bgrant0607
Copy link
Member

There's still the broader issue of making replication controller do something useful (e.g., raising events, including number of pending pods in status) in this scenario.

@bgrant0607 bgrant0607 added area/usability priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jan 7, 2015
@bgrant0607 bgrant0607 added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Feb 5, 2015
@bgrant0607 bgrant0607 modified the milestone: v1.0 Feb 6, 2015
@bgrant0607 bgrant0607 removed this from the v1.0 milestone Mar 27, 2015
@bgrant0607 bgrant0607 added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label May 8, 2015
@liggitt
Copy link
Member

liggitt commented May 4, 2019

xref #76370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

9 participants