Vault becomes slow, requests time out with `context deadline exceeded`, and `vault.expire.num_leases` is at 4 million
AdvancedTroubleshootingSecrets management: Vault, External Secrets and SOPS
Answer
Likely causes → A lease explosion. Some client logs in or requests dynamic credentials on every request (a CronJob, Lambda or app with no token caching). Each request creates a token or lease that lives until its TTL expires.
Diagnose →
vault read sys/internal/counters/activity
vault list sys/leases/lookup/auth/kubernetes/login | wc -l
vault read sys/metrics -format=json | jq '.Gauges[] | select(.Name|test("num_leases"))'
Fix → Find the offending role in the audit log and fix the client to reuse its token (Vault Agent auto-auth with caching). Shorten that role's token_ttl. Revoke the excess with vault lease revoke -prefix auth/kubernetes/login, carefully and in batches.
Prevent → Set lease count quotas (vault write sys/quotas/lease-count/k8s max_leases=50000 path=auth/kubernetes) and alert on lease growth.
More on Secrets management: Vault, External Secrets and SOPS
`vault kv get secret/app/db` returns `Code: 403. Errors: * permission denied` although the policy allows `secret/app/*`BeginnerVault pod restarted and `vault status` shows `Sealed: true`; every app now fails to fetch secretsBeginnerPod stuck in `Init:0/1`; the `vault-agent-init` container logs `error authenticating: ... Code: 403 ... * permission denied`IntermediateAfter a cluster upgrade, Vault Kubernetes auth fails for every pod with `error validating token: invalid issuer (iss) claim`AdvancedPods annotated with `vault.hashicorp.com/agent-inject: true` start without a Vault sidecar, and the app fails on a missing fileBeginnerExternalSecret shows `SecretSyncedError` with `AccessDeniedException: ... is not authorized to perform: secretsmanager:GetSecretValue`Intermediate