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

Workloads get new dynamic secrets by Vault when new replicas are created #149

Open
braybaut opened this issue Mar 4, 2022 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@braybaut
Copy link

braybaut commented Mar 4, 2022

Hi, wonderful people.

I'm using Vault to provide dynamic AWS secrets to on-prem Kubernetes clusters and reach AWS components, I created the storage class to get the credentials and I attach the volume to workload, so far so good, however when the workloads scale up to X replicas, the vault CSI get dynamic secrets to each new replica if I have 50 replicas I will have 50 new access key but, the vault secret object just keep the last AWS credentials.

I think it's a bug because doesn't make sense to have an access key for each replica,

is it expected behavior? should the storage class just get a dynamic secret for a workload with N replicas and rotate it through pull interval and TTL?

Thanks in advance.

@hamdifourati
Copy link

We are having the same issue with database dynamics credentials.

@tomhjp
Copy link
Contributor

tomhjp commented Jun 21, 2022

This was filed earlier, but I commented on #151 which shares a lot in common with this issue. I'd be interested to get thoughts on my comment there, as it seems like there could be some unintended consequences to sharing dynamic secrets among pods if it's done naively, but I'm open to feedback on that.

One thing #151 doesn't cover is the fact that the Kuberentes secret object gets re-written a lot with the different values from each pod, which is a bit gross. Thanks for highlighting it.

@tomhjp tomhjp added the enhancement New feature or request label Jun 21, 2022
@Freyert
Copy link

Freyert commented Jul 11, 2022

@braybaut, just to be clear every single pod that is referencing the vaul-csi-provider volume has the same AWS Credential? This being the last AWS credential provisioned?

I had imagined that each pod would get its own credential, but what you're describing does sound like a bug if they all have the same credential. Plus the 49 unused credentials.

@tomhjp
Copy link
Contributor

tomhjp commented Apr 28, 2023

Update: We recently released the Vault Secrets Operator, which has a much better model for satisfying a "1 secret per deployment" pattern - you can define a VaultDynamicSecret custom resource to create a Kubernetes secret managed by the operator, and all pods can mount the same leased secret into a volume/env var. Deployments can also opt in to rolling restarts by using the RolloutRestartTarget field.

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

No branches or pull requests

4 participants