-
Notifications
You must be signed in to change notification settings - Fork 40k
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
WIP: Expose secrets to containers as env vars #4890
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
Assigning @erictune for now, but will try to find time to look at this. |
@liggitt fyi |
I'm trying to figure out what about this is Secret specific. You might want to set an env var from a file in any sort of volume. In particular, we've talked about a "Config" volume type that would be very similar to a secret volume. |
@erictune You make a good point, I will think about how to generalize this; On Thu, Mar 5, 2015 at 5:06 PM, Eric Tune notifications@github.com wrote:
|
Could you explore the idea of making this part of Maybe instead of specifying One difference that occurs to me is EnvVar is per container while this approach seems to apply to all containers in a pod. |
@erictune I hadn't thought of that particular mechanism for env adaptation, On Fri, Mar 6, 2015 at 5:04 PM, Eric Tune notifications@github.com wrote:
|
@erictune I was thinking about the approach you mentioned and while I like the API better I think there are a couple non-starters with modifying the
Other questions that came to mind:
|
I agree that we don't want the secret env vars in the docker metadata, since that may hit disk. I'm not sure I understand the threat for
Also, assuming there is a threat via
Remaining comments assume we don't consider Will it hinder reuse of community images if user has to add |
@erictune I think you convinced me that /proc isn't a threat. What about capturing secret data in a docker commit, though? |
@erictune I'm a lot less confident about mutating the command than I was initially. How do you know which shell the user prefers? What do you do for scratch images without a shell? etc. |
@erictune I guess if you can opt-in with a pre-start hook, that potentially solves the issue of knowing how to mutate the command just right. What about these questions?
|
@vmarmol can you link to your pre-start-hook patch? |
@pmorie Reading this issue: |
@pmorie |
@erictune I don't have a patch, just a proof of concept :) I'm happy to develop that into a working solution. It should be relatively simple, the harder part will be the integration into Kubelet. Proof of concept from previous post: "If you override the entrypoint (docker run --entrypoint="") you can run a the pre-start and then have that exec the actual command. It requires us to inject the binary we want to run into the container. We can do it with a volume:
A bit hacky, but it does work :) the part we may need to figure out is how to restore the actual entrypoint. I'm pretty sure we can get that from Docker though. If the binary we inject is a statically linked binary this should work just fine. If we're worried about leaving the binary in the container, it can even erase itself once it's done." |
@erictune Point taken wrt commit.
Agree, the sticky bit of having the info in the docker metadata is that the daemon may write it to disk somewhere. By 'checkpoint' did you mean the metadata store? I'm not especially hopeful about getting the daemon to use tmpfs; my gut feeling is that it's more viable to just avoid having these in the metadata. @vmarmol I agree, the hard part of the approach you outlined above is integration into the kubelet. It sounds like a finalizer to me, with the added challenge of the binary. I'm assuming you meant for the binary to set the environment based on the content of a secret (please correct me if I'm wrong). I think that would result in good behaviors:
|
@vmarmol I think we will need to think through the matrix of all the different permutations of
|
@smarterclayton any thoughts about the above re: pre-start hooks? |
@pmorie yes this would mean the secrets won't be in proc or the ENV config. We may have to pass them to the binary or place them in disk/tmpfs somewhere for it to access though. The binary should also exec the final command as you mentioned. We may even be able to use this functionality to inject some debugging binaries in the user's container for our use later (but that's unrelated). The table LGTM as well, in general: append(entrypoint, cmd...) and exec that. |
@vmarmol I think we're on the same page about the generalities. As always, the devil's in the details. Say that:
type Lifecycle struct {
// other fields omitted
PreStart *Handler
} This doesn't get us all the way, though -- for example, where does the env setter binary come from?
The container-init binary has to run pre-start hooks and invoke the entrypoint. Going back to the definition of This seems like it would generalize work with the planned 'config' resource as well. Any thoughts @vmarmol @thockin @erictune @smarterclayton ? |
@pmorie why do they have to be two separate binaries (it shouldn't be a problem to support more than one, I'm just curious why you think we need two). I would image that users would expect the pre-start hook to run with the ENV their container would run with so it should already have the relevant secrets no? The container-init can do the ENV setup on itself and let its children inherit that. |
@vmarmol I expect there to be a couple other concerns that will need their
|
Injecting a binary requires injecting a whole volume, so we should be able to do multiple without a problem if we do go that route. |
@vmarmol agree On Wed, Mar 25, 2015 at 12:37 PM, Victor Marmol notifications@github.com
|
@vmarmol I think now you're right regarding the env; the container-init binary will have to have this responsibility, in order for the env to be set in the child process (the entrypoint). Agree? Disagree? |
@pmorie agree |
I'm unavailable this week. Will take a look when I get back, or reassign to vmarmol. |
@erictune this is parked for now, I want to do it another way. On Mon, Apr 6, 2015 at 4:11 PM, Eric Tune notifications@github.com wrote:
|
@pmorie I'm closing this for now, since it hasn't been commented on in > 1month and you indicate it's being done a different way. |
@brendanburns, my bad, I didn't realize this was still open. Thanks. On Thu, May 7, 2015 at 1:04 PM, Brendan Burns notifications@github.com
|
WIP for #4710.