-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
Support dynamic configuration distribution #1553
Comments
This goes along with the 12-factor app paradigm of storing configuration info (e.g.: db_name, db_host, db_port, redis_host, etc...) in the environment and allows for separation of configuration info from the deployable code in a way that facilitates different settings for different environments (e.g.: test, stage, prod). Probably a good idea to provide an 'adapter' or way for 12-factor apps written to depend on environment variables being set to get this info from etcd. |
This tool already exists: https://github.com/mattn/etcdenv |
@bketelsen Awesome! |
So we encourage to put all config stuff in ENVs and if need be, instead of distributing these at runtime through docker parameters, we could use etcdenv as first bootstrap step and generate the additional config after that right? The next step would be to generate config files from these values and using sed etc. is just not clean in my opinion. I would propose augeas.net for that. (I'll write a guideline issue in the coming days, just wanted to get the idea out here already in context) That happened to be longer than I thought, but better start the discussion now and get more streamlined thoughts into the actual guideline issues. |
for an unrelated project, we released crypt [1] this weekend, which uses openpgp keys to encrypt configuration files and store them in etcd or consul. Maybe over kill here, but another option. |
Interesting, not sure if it's perfectly easy to integrate, but encrypted containers and ldap wouldn't be either I assume. Would you favour crypt over encrypted data only containers? |
I am using crypt in my k8s setup, but you're correct, it's not the easiest thing to use. We have it set up to encrpyt in our CI environment. It also requires that you either keep your private key in a docker container or on the docker host. Not the best setting for everyone, but it is very flexible. Using it in CI allows me to have multiple keys (one for dev, production, etc). |
crypt does have a benefit, it can be used from a shell outside the docker container to inject ENV vars (with some bash scripting) or can be used as a library inside your app. |
How much overhead does it introduce for decryption in a docker container? Is there any filesize/number limit? Any chance this is something possible to be proposed as secret distribution solution in k8s itself? |
the encryption and decryption is very quick, not noticeable. Any limitations would be imposed by etcd or consul, in terms of maximum key size, or maximum amount of data that could be POSTed. If kubernetes were to adopt something like this it would make more sense to bake it in completely and have every k8s namespace get its own keypair. I'm happy to help think through the idea. |
@stp-ip Good discussion, but please file a new issue for secret distribution, since that has additional requirements. |
@bketelsen What about library size added to each image decrypting secrets? Any huge overhead there? @bgrant0607 Was not my intention to completely hijack. Will get a few issues done soon, which will be more suited for general and pinpointed discussion. |
ENV vars are such a hack. Can't we do better? Can't we offer managed On Wed, Oct 22, 2014 at 8:24 AM, Michael Grosser [email protected]
|
Would the managed volumes be persisted to disk on the node or dropped into a tmpfs mount? I can see GC benefits to the tmpfs route, but on a hard node restart none of the pods could come back up without phoning home for configs. |
@thockin We also have internal systems akin to the env. vars. / etcd approach. There likely won't be just one way to do this. People writing their applications from scratch could even talk directly to etcd. I view env. vars. as a bridge to legacy apps, or at least a familiar mechanism for people who are either new to the approach and/or have simple use cases. Look on the bright side: it's better than changing command-line flags. :-) |
@bgrant0607 @thockin @stp-ip A couple of thoughts:
|
|
One mechanism for notification might be if the kubelet did an http |
Or have Kubelet send a Unix signal like SIGTERM, which can be caught by apps that are able to re-read their config without restarting, or not caught by apps that want to restart when their config changes. |
@davidopp Also a good idea. Summarizing possible reload mechanisms:
I'm not sure I really love the idea of having the kubelet restart the pod on a config change; it seems like restarts should be part of a higher level mechanism. That said my context is undoubtedly colored by working on OpenShift. Update: Added 5 above after thinking through my last sentence above. For context, I'm thinking of a use-case for OpenShift, where a user would want update to config to result in a new deployment. |
How much of this needs to be done by Kubelet vs a side-car container. I'm On Mon, Jan 19, 2015 at 1:10 PM, Paul Morie [email protected]
|
@thockin you have mentioned side-cars a couple of times. Is there a general issue talking about whether we should use them? I'm not sold on them yet, versus more narrowly-tailored mechanisms with more specific error handling, etc. |
Further work on this done here: #10982 |
Putting a link here so I remember to take a look: https://github.com/kelseyhightower/confd |
@kelseyhightower and I also wrote crypt[1], which might be interesting in that it uses etcd/consul as a backend but allows configurations to be encrypted. |
Can someone summarize the action items remaining on this issue? |
Closing in favor of #18455 |
A related topic came up on IRC today.
@pwhiteside pointed out envconsul, which can be used to distribute environment variables (or, in theory, arbitrary key-value config data). Something similar could be supported on top of etcd. As with master election (#1542) and endpoint listing, it would be useful to have a canonical solution available in the Kubernetes ecosystem that wasn't tied to a specific key-value store API.
Even if we don't provide explicit support, it would be useful to document this pattern for others.
The text was updated successfully, but these errors were encountered: