-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Containers should support inherent garbage collection & restart policy #12856
Comments
Saw some flags like |
Copied from #12760
Let's say i set up a cron job to remove all of the exited containers nightly, would it break the behavior of kubelet? |
Unfortunately, yes. Kubelet mostly would still work, but you'd observe some inconsistencies / undesirable pod behaviors due to the fact that kubelet relies on the dead containers for checkpointing. E.g. Suppose you have a pod with two containers and a "Never" restart policy.
There are also minor problems about updating pod status, if the pod is still in the running state. We plan to fix this in the long run by checkpointing kubelet. For the shorter term, we can keep an in-memory cache that would help with situation like this (but would not survive a restart). On the other hand, it is perfectly fine to remove containers from deleted pods (i.e., no longer visible from the apiserver) (#8347). |
Here are 3 issues reported here, and first two are kind of design issues, and the latest one is sort of support issue / bug on Ubuntu machine. I re-opened #11733 for it, and leave this one for first two.
Why do you care about so much those dead containers? Do you have OOD issue badly?
Do you have any use cases in mind to have restart policy at container level? |
Yeah, indeed. Yet since kubelet relies on the (dead) containers to make a strategy, it's quite reasonable to keep it as it is in the short term.
Suppose we have a container A acting as a web server (let's say tomcat) which consumes a war provided by a container B. The only job for B is to copy the war somewhere A could access and exit gracefully. In this case, the restart policy is Always for A and OnFailure for B. |
Interesting. @bgrant0607, what would the backward compat issues be for this? On Wednesday, August 19, 2015, Emma He notifications@github.com wrote:
|
What if the user does not care about it himself? This may sound odd, yet this feature can always be enabled for someone who needs it badly. /cc @dchen1107 |
Kubelet would not be reporting accurate status, and/or respecting the restart policy in this case. It seems to me that this should not be optional. Is there any reason for removing all dead containers right away other than the potential saving in disk space? |
See the original discussion re. restart policy in #127. I do not envision per-container restart policies. In addition to a number of semantic problems, it would be insufficient for what people want to use it for, such as #12588. I also don't envision supporting general-purpose dependencies, which also have semantic problems. I do support addressing the most common use case, which is populating a volume upon pod startup (#831). PRs for that would be welcome. We agree that container GC needs to be improved. I don't like the idea of exposing knobs in the API to control it, however. We also agree that we should move away from relying entirely on dead containers as tombstones. As mentioned above, Kubelet would then need its own tombstones (#489). |
I just wanted to add that whether there is checkpointing or not, there is still a window of time where kubelet needs to inspect the dead container for information and save it somewhere. There would always be problems if user come in and remove containers underneath kubelet. |
To be honest, i dont fancy this myself. Yet my partner insists and i'm just trying to make sure that he hits a dead end :-(
What if the user set
I'm not sure how semantic problems matter, yet i'm fine with that if you insists. |
On the subject of restart policies: It seems unacceptable to have an application potentially flap forever because it cannot be started properly. In most production environments using a process manager we would never have an application always restart. Instead we would set some limit to the number of times to retry and then just stop after taht limit. This would allow our monitoring tools to alert that the application is indeed down. As it stands the RC would keep trying to restart the container and we would have a hard time determining if the application was down. |
Issues go stale after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
1 garbage collection
As it's well known to us all, auto container gc could be kinda tricky (race condition etc.)
Hence I guess a raw field of
Container
struct to support stuff likedocker run --rm
would help a lot, which aims to manage user-defined gc as long as the container terminates.2 restart policy
Maybe i'm nuts yet I'll bet restart policy makes more sense to a container-level instead of pod-level.
3 kubelet component
My kubelet suffers like
which has not been quite settled down. (Also see in #11733)
I tried to mount /var/lib/docker as a volume of kubelet once, which didnt work. Any ideas?
ENV: k8s 1.0.0-dir / docker 1.7.1 / ubuntu14.04
startup Opts for kubelet
The text was updated successfully, but these errors were encountered: