You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Config Maps and Secrets usage within Configurations #1504
As an app/function developer, when I have a config map or secrets, I need the ability for my application/function to be updated when the config map or secret changes
Actual Behavior
An approached used by Kubernetes users is to use read-only volume mounts. But the Knative webhook currently prevents the use of volumes. Secondly, I could use the downward API to expose these properties as environment variables but it doesn't propagate updates.
Steps to Reproduce the Problem
Create a configuration with a volume mount providing a config map or secret
Try to create this configuration
It will fail with an error message from the web hook
changed the title [-]Knative should allow read only ConfigMap & Secret Volumes[/-][+]Knative should allow apps/functions to use ConfigMap & Secret Volumes[/+]on Jul 6, 2018
changed the title [-]Knative should allow apps/functions to use ConfigMap & Secret Volumes[/-][+]Config Maps and Secrets should be able to be referenced by a Configuration [/+]on Jul 6, 2018
changed the title [-]Config Maps and Secrets should be able to be referenced by a Configuration [/-][+]Config Maps and Secrets usage within Configurations[/+]on Jul 6, 2018
A Volume, ConfigMap or Secret is basically an external source of "state" which isn't snapshotted from the Configuration the way that a Docker container or a Revision is. This makes rollback and determining "what changed" more difficult, as there are more places to look, and it's not immediately obvious how to rollback a ConfigMap or Secret update if you didn't save the object definition before update.
Out-of-band updates to the application's state need to be rolled out in some fashion to the running Pods/containers. It's not clear:
How to express a desire to do this. Since the state of the object hasn't changed, the controller would need to understand all the possible additional references which might be changed to update the state. Waiting for the revision to scale to zero is one option. Another option would be to have a max lifetime on each Pod spawned by the Revision.
How to control the rate of rollout to allow this to be done "safely". Typically, we rely on the user's configuration of Route to determine how fast they are willing to rollout changes, but this bypasses that mechanism.
There are a number of parallels here between changing configuration references and using a docker image tag and/or git repo reference without a revision tag (in that the Configuration spec may not change, but the user would like a new Revision to be snapshotted).
I stumbled here after I realized that Revisions don't capture configmaps, and I started thinking why we need anything outside the container at all. For configmaps, it's possible to take advantage of the volume being reloaded without the pod being rescheduled if your application supports that. For secrets, you may want the same thing, and/or you may not want to store any secrets in the container image.
If a "soft reload" isn't an important consideration, then it seems like the answer would be a sidecar or init container for fetching secrets and simply building all your config files into your container image and/or setting the environment variables in the container spec. I like the idea of a sidecar for secrets even more than trying to track secrets in a revision because secrets have their own lifecycle, ie certs expire so rolling back to a working config and having to also take an expired cert is probably not desirable.
I agree that a sidecar and/or external interface (ala Vault) is probably the way to go.
My personal preference would be to steer users towards using container-level identity
from Kubernetes SIG and the Vault for secrets which can't be managed via the identity service. Unfortunately, this doesn't have a great kicking-the-tires setup experience, as anything involving credentials and external storage sucks.
I think there is an interesting question of how to support mounting a ConfigMap or Secret into the container via the downwards API.
Note that you can use environment variables today; this would produce a smeared update as new pods are created. We may want to consider adding a "max age killer" which would remove knative pods older than a certain age so that secret and configmap changes are picked up within a certain maximum amount of time.
Activity
[-]Knative should allow read only ConfigMap & Secret Volumes[/-][+]Knative should allow apps/functions to use ConfigMap & Secret Volumes[/+][-]Knative should allow apps/functions to use ConfigMap & Secret Volumes[/-][+]Config Maps and Secrets should be able to be referenced by a Configuration [/+][-]Config Maps and Secrets should be able to be referenced by a Configuration [/-][+]Config Maps and Secrets usage within Configurations[/+]mattmoor commentedon Jul 6, 2018
On the agenda for API QG 7/11. thanks for leading this @dprotaso
evankanderson commentedon Jul 6, 2018
/assign evankanderson
evankanderson commentedon Jul 6, 2018
I probably won't be able to make the 7/11 WG. @cooperneil should be there for the discussion at a minimum.
evankanderson commentedon Jul 6, 2018
A few additional considerations:
Volume,ConfigMaporSecretis basically an external source of "state" which isn't snapshotted from theConfigurationthe way that a Docker container or aRevisionis. This makes rollback and determining "what changed" more difficult, as there are more places to look, and it's not immediately obvious how to rollback aConfigMaporSecretupdate if you didn't save the object definition before update.Revision.Routeto determine how fast they are willing to rollout changes, but this bypasses that mechanism.There are a number of parallels here between changing configuration references and using a docker image tag and/or git repo reference without a revision tag (in that the
Configurationspec may not change, but the user would like a newRevisionto be snapshotted).winmillwill commentedon Aug 13, 2018
I stumbled here after I realized that Revisions don't capture configmaps, and I started thinking why we need anything outside the container at all. For configmaps, it's possible to take advantage of the volume being reloaded without the pod being rescheduled if your application supports that. For secrets, you may want the same thing, and/or you may not want to store any secrets in the container image.
If a "soft reload" isn't an important consideration, then it seems like the answer would be a sidecar or init container for fetching secrets and simply building all your config files into your container image and/or setting the environment variables in the container spec. I like the idea of a sidecar for secrets even more than trying to track secrets in a revision because secrets have their own lifecycle, ie certs expire so rolling back to a working config and having to also take an expired cert is probably not desirable.
evankanderson commentedon Aug 13, 2018
I agree that a sidecar and/or external interface (ala Vault) is probably the way to go.
My personal preference would be to steer users towards using container-level identity
from Kubernetes SIG and the Vault for secrets which can't be managed via the identity service. Unfortunately, this doesn't have a great kicking-the-tires setup experience, as anything involving credentials and external storage sucks.
I think there is an interesting question of how to support mounting a
ConfigMaporSecretinto the container via the downwards API.evankanderson commentedon Aug 13, 2018
Note that you can use environment variables today; this would produce a smeared update as new pods are created. We may want to consider adding a "max age killer" which would remove knative pods older than a certain age so that secret and configmap changes are picked up within a certain maximum amount of time.
8 remaining items
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container.
Allow VolumeMounts to be specified in Container. (#3061)
Allow VolumeMounts to be specified in Container. (knative#3061)
Update dependabot configurations (knative#1504)