hashicorp / vault-k8s

First-class support for Vault and Kubernetes.
Mozilla Public License 2.0
786 stars 169 forks source link

Inject the Agent as a native sidecar #620

Open busser opened 6 months ago

busser commented 6 months ago

Hi 👋

Is your feature request related to a problem? Please describe.

Running the Vault Agent as a sidecar container is extremely useful. However, like with most sidecars, we quickly run into issues that require custom solutions. For example:

Kubernetes native sidecars aim to solve these issues for all sidecars, including the Vault Agent.

Describe the solution you'd like

I would like the Agent Injector to support injecting the Agent as a native sidecar.

Concretely, this means that the Injector should:

Implementing the startup probe in the Agent may require further discussion. This may require adding a new endpoint to the Agent.

We could start by adding a boolean annotation that enables this behaviour on annotated pods. The annotation could be named agent-native-sidecar for instance. I think that eventually this behaviour could become the default on clusters where the native sidecars feature is enabled.

Additional context

I am more than happy to help implement this feature.

tvoran commented 6 months ago

Thanks for raising this too! The lack of a long-lived sidecar option is precisely why we ended up adding persistent caching to Vault agent, but it would be great to remove the need for that complexity. I've been meaning to try this out for a while, but contributions welcome!

komapa commented 6 months ago

I would like to see this functionality implemented as well now that native sidecars are beta in 1.29 and we have 1.30 already released. I can help test any implementation with real use cases.