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

kubelet: add --runonce flag #1534

Merged
merged 2 commits into from
Oct 4, 2014
Merged

Conversation

proppy
Copy link
Contributor

@proppy proppy commented Oct 2, 2014

Usage

kubelet --runonce --config some/pod-manifest.json

Description

The kubelet runs the pod specified by the manifest and exits when the containers are running.

This is useful for being able to bootstrap a kubelet pod with the kubelet binary.

Related

#246, #490

TODO

  • add runonce_test (after I figure out why the kubelet test are broken for me)

@bgrant0607 bgrant0607 self-assigned this Oct 2, 2014
@brendandburns brendandburns reopened this Oct 2, 2014
@brendandburns
Copy link
Contributor

oops, github #fail

Err error
}

// RunOnce poll from one configuratin update and run the associated pods.
Copy link
Member

Choose a reason for hiding this comment

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

configuration

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

@erictune
Copy link
Member

erictune commented Oct 2, 2014

I'm assuming you are want to use kubelet with --runonce as part of the boot process for a machine, to for example start cadvisor from a local manifest file? Is that right?

Will the kubelet poll the apiserver for pods when run with --runonce, or does it only start file-based pods? I haven't traced all the code yet, but I think it talks to apiserver.

Assuming the above is true, is there a race where sometimes the kubelet only starts locally configured pods, and other times, it manages to be noticed by the apiserver, get apiserver-managed pods scheduled on it, and then start those pods too? If so, that seems like it could cause problems, or at least be surprising.

If it works for your use case, I wonder if it makes sense to only start containers from a local manifest when kubelet is run with --runonce.

if kl.dockerPuller == nil {
kl.dockerPuller = dockertools.NewDockerPuller(kl.dockerClient, kl.pullQPS, kl.pullBurst)
}
if kl.healthChecker == nil {
Copy link
Member

Choose a reason for hiding this comment

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

why health check if kubelet is going to exit soon? Seems like it just leads to unpredicable behavior for --runonce.

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

@erictune
Copy link
Member

erictune commented Oct 2, 2014

Looks good aside from previous comments.

@proppy
Copy link
Contributor Author

proppy commented Oct 2, 2014

I'm assuming you are want to use kubelet with --runonce as part of the boot process for a machine, to for example start cadvisor from a local manifest file? Is that right?

@erictune Yes, I updated the description to reflect this.

@proppy
Copy link
Contributor Author

proppy commented Oct 2, 2014

Assuming the above is true, is there a race where sometimes the kubelet only starts locally configured pods, and other times, it manages to be noticed by the apiserver, get apiserver-managed pods scheduled on it, and then start those pods too? If so, that seems like it could cause problems, or at least be surprising.

The changes in cmd/kubelet.go should disable etcd watching w/ --noonce. See: https://github.com/GoogleCloudPlatform/kubernetes/pull/1534/files#diff-a9f93108ac59ff44885fc0aea2f29e71R112

@proppy
Copy link
Contributor Author

proppy commented Oct 2, 2014

If it works for your use case, I wonder if it makes sense to only start containers from a local manifest when kubelet is run with --runonce.

Currently it only poll local file and/or an url, update the documentation to be more explicit.

@erictune
Copy link
Member

erictune commented Oct 2, 2014

LGTM

@proppy
Copy link
Contributor Author

proppy commented Oct 2, 2014

@erictune Thanks, I do want to add more tests before merging.

@bgrant0607
Copy link
Member

@proppy Please squash your commits when you're done, also.

@proppy
Copy link
Contributor Author

proppy commented Oct 2, 2014

@bgrant0607, will do I like keeping them that way during review, as it helps to review how the comments were addressed

@thockin
Copy link
Member

thockin commented Oct 2, 2014

please hold this PR until I can review, ETA tonight or tomorrow.

On Thu, Oct 2, 2014 at 3:39 PM, Johan Euphrosine notifications@github.com
wrote:

@bgrant0607 https://github.com/bgrant0607, will do I like keeping them
that way during review, as it helps to review how the comments were
addressed

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

@@ -63,6 +63,7 @@ var (
allowPrivileged = flag.Bool("allow_privileged", false, "If true, allow containers to request privileged mode. [default=false]")
registryPullQPS = flag.Float64("registry_qps", 0.0, "If > 0, limit registry pull QPS to this value. If 0, unlimited. [default=0.0]")
registryBurst = flag.Int("registry_burst", 10, "Maximum size of a bursty pulls, temporarily allows pulls to burst to this number, while still not exceeding registry_qps. Only used if --registry_qps > 0")
runonce = flag.Bool("runonce", false, "If true, exit after spawning pod from local manifests or remote urls. Exclusive with --etcd_servers and --enable-server")
Copy link
Member

Choose a reason for hiding this comment

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

s/pod/pods/

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

@thockin
Copy link
Member

thockin commented Oct 3, 2014

feedback done, hold removed (though now there is feedback)

On Thu, Oct 2, 2014 at 4:57 PM, Tim Hockin thockin@google.com wrote:

please hold this PR until I can review, ETA tonight or tomorrow.

On Thu, Oct 2, 2014 at 3:39 PM, Johan Euphrosine <notifications@github.com

wrote:

@bgrant0607 https://github.com/bgrant0607, will do I like keeping them
that way during review, as it helps to review how the comments were
addressed

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

@proppy
Copy link
Contributor Author

proppy commented Oct 3, 2014

rebased

@proppy
Copy link
Contributor Author

proppy commented Oct 4, 2014

Added basic tests and rebased, PTAL

@thockin
Copy link
Member

thockin commented Oct 4, 2014

LGTM

@thockin
Copy link
Member

thockin commented Oct 4, 2014

ok to merge in-hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants