-
Notifications
You must be signed in to change notification settings - Fork 54
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
Lease cache not working for PKI engine #238
Comments
Hey there! We chatted about this internally and we think this might be a bug. It might also be related to this issue. You're right, as the docs say, this should be the expected behaviour:
To help our investigation, could you let us know if you're using |
I realize I might have gotten my wires crossed here -- are you using Vault Agent's templating to retrieve the PKI cert? You linked the templating docs so I might have made an assumption that you were. |
Thanks for the quick reply @VioletHynes. I'm actually using the Still, the behavior I have with MySQL credentials aligns with the documentation; a MySQL secret is NOT being generated every Also, the reason I thought that the In the end, what I understood is that in the meantime (sometime between 2021 and today), the caching mechanism was added on the PS: I was able to setup a configuration with PKI using the |
Hey there! Apologies, it does seem like I got a bit mixed up. The behaviour you're experiencing is expected behaviour. The root of why is this doesn't work is that this is going through Vault Agent's caching, which today does cache renewable, leased secrets, but does not cache non-renewable leased secrets. The cache may support these kinds of secrets in the future, but it does not today. It only supports caching secrets it can renew. |
So, do I understand correctly that a certificate will always be renewed, regardless? For instance, if we look at the current renew time in our kubernetes cluster, it is set (and I think this is the default when enabled but not specified) to two minutes. Meaning, every two minute a new certificate will be created, regardless of the lifetime of the "current" certificate? If this is true, it is a pity :-( as I wanted to use this CSI with Stakater/reloader and restart our deployment/statefulset when the certificate is about to expire. Now it restarts our pods every two minutes which is ...a bit too fast for my taste. The other secrets (e.g. password for database, kv secrets, ...) seem to behave as expected. Is there nothing that can be done about this? Or some work-around to make the vault CSI driver run more like the expected route? I've also tried cert-manager btw, but there they don't really want to expose the CA chain in a meaningful way, meaning that, for mTLS scenarios, this won't work either. Or, does anybody know if I can do a hybrid? Meaning: cert-manager for certificates and CSI for fetching CA chains (hopefully without restarting every two minutes but only if a change has detected?) |
Any updates from the project maintainers on the likelihood of this issue being prioritized? We wish to continue using Vault CSI for our Kubernetes workloads but this issue incurs such load on our Vault servers that it potentially poses a non-starter scalability issue. |
Hello,
I have been struggling to integrate the PKI engine with
csi-driver
using Vault.For context, this is what I have on my test setup:
1m
and auto-rotation enabled5m
1h
For the MySQL use case everything works smoothly: my pod initializes, fetches credentials, and every minute, the csi-driver-vault replies with the cached reply, and does not request new credentials from Vault. Close to the final of the lease duration, the csi-driver actually requests a new credentials from Vault and its refreshed inside the pod.
For my PKI use case, I'm not able to make this work. Every minute, the csi-driver ignores the lease of the certificate and always fetches a new one from Vault.
See the logs below:
MySQL logs
PKI logs
The log entry that catches my attention is this one: pass-through response; secret not renewable. Indeed, the PKI secret is not renewable, but looking at the documentation here I was expecting a new certificate to be fetched only when close to 85% of the lease duration.
I have gona through a lot of issues around this topic (#90, #82, #202), but I can't figure out what's wrong in my setup.
Can you help?
Thanks.
The text was updated successfully, but these errors were encountered: