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

Pod init hooks #9836

Closed
bkeroackdsc opened this issue Jun 16, 2015 · 9 comments
Closed

Pod init hooks #9836

bkeroackdsc opened this issue Jun 16, 2015 · 9 comments
Labels
area/api Indicates an issue on api area. area/usability priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/node Categorizes an issue or PR as relevant to SIG Node.

Comments

@bkeroackdsc
Copy link
Contributor

I have a container in a pod whose only job is to populate some configuration values within the pod-local etcd on startup. This works fine except that after it exits successfully Kubernetes continually respawns it over and over again.

My current hack is to append && tail -f /dev/null to the container command to allow it to "run" indefinitely.

It would be great if Kubernetes allowed one to specify certain containers as non-respawning in the pod spec.

@mikedanese
Copy link
Member

Is it possible for you to use a container lifecycle hook? http://godoc.org/github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1#Lifecycle

RestartPolicy is almost what you want but it is applied over all the containers in a pod. http://godoc.org/github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1#RestartPolicy

@bkeroackdsc
Copy link
Contributor Author

@mikedanese RestartPolicy would be perfect if only it were per-container rather than pod.

I wouldn't mind trying to implement this if there's interest.

@mikedanese
Copy link
Member

cc @bgrant0607 @davidopp for api changes.

@thockin
Copy link
Member

thockin commented Jun 16, 2015

The corner cases around mixed-restart-policy pods is not worth the energy.
This is what lifecycle hooks should do, and if they aren't sufficient, we
should make them sufficient.

On Mon, Jun 15, 2015 at 8:26 PM, Mike Danese notifications@github.com
wrote:

cc @bgrant0607 https://github.com/bgrant0607 for api changes.


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

@davidopp
Copy link
Member

It's true that the most common use cases of sidecar containers, for example data loader and log saver, will run forever. However, IIRC we've occasionally told people to use sidecar containers for various kinds of initial configuration, and in those cases it seems that having the sidecar run once to completion and the other pod restart would be desirable.

I guess the lifecycle hook proposal would be that you merge the configuration container logic into the main container's logic, so that you have just one container, and have the PreStart hook invoke the former?

Anyway, I don't have a strong opinion.

@thockin
Copy link
Member

thockin commented Jun 16, 2015

We've thrown out the idea of having two stages in a pod - stage 1 only
completes when stage 0 is done. E.g. all the containers in stage 1 have
completed successfully. Like so many other things, it is a matter of
priority and making time for it among the ocean of other things going on :)

On Mon, Jun 15, 2015 at 10:47 PM, David Oppenheimer <
notifications@github.com> wrote:

It's true that the most common use cases of sidecar containers, for
example data loader and log saver, will run forever. However, IIRC we've
occasionally told people to use sidecar containers for various kinds of
initial configuration, and in those cases it seems that having the sidecar
run once to completion and the other pod restart would be desirable.

I guess the lifecycle hook proposal would be that you merge the
configuration container logic into the main container's logic, so that you
have just one container, and have the PreStart hook invoke the former?

Anyway, I don't have a strong opinion.


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

@davidopp
Copy link
Member

Yeah, I was assuming the user would be responsible for orchestrating the dependency between the two containers (e.g. the application in the main container would wait until the configuration data was populated by the other container before finishing its startup).

@bgrant0607
Copy link
Member

Pod-level hook or container volume #831 would be the right solution.

Original discussion re. restart policy was #127.

@davidopp davidopp self-assigned this Jun 17, 2015
@davidopp davidopp added team/master priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Jun 17, 2015
@bgrant0607 bgrant0607 changed the title Mark container within pod as "do not respawn" Pod init hooks Jun 20, 2015
@bgrant0607 bgrant0607 added area/api Indicates an issue on api area. sig/node Categorizes an issue or PR as relevant to SIG Node. area/usability labels Jun 20, 2015
@bgrant0607
Copy link
Member

Closing as a dupe of #4282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/usability priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
Development

No branches or pull requests

5 participants