-
Notifications
You must be signed in to change notification settings - Fork 469
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
Error unsealing vault due to key index out of range #1085
Comments
Hi @gitdr, aren't there any left PVCs with previous instance data? Because usually, that causes this issue. |
I am getting the exact same issue, but with the azure keyvault backend. I deleted the PVCs, but never scaled out to more than 1 vault instance. All other unseal keys are there. bank-vaults version: 1.4.2 time="2020-09-10T10:05:30Z" level=error msg="error unsealing vault: unable to get key 'vault-unseal-5': error getting secret for key 'vault-unseal-5': keyvault.BaseClient#GetSecret: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="SecretNotFound" Message="A secret with (name/id) vault-unseal-5 was not found in this key vault. If you recently deleted this secret you may be able to recover it using the correct recovery command. For help resolving this issue, please see https://go.microsoft.com/fwlink/?linkid=2125182\"" |
Always make sure that if you delete the Vault storage backend (PVC, Object Storage, DB, etc...) you also delete the Unseal Keys from the unseal key storage (in this case Azure Key-Vault). The Vault data and the unseal keys are having the same lifecycle period and they live together. |
I am still getting this issue after performing the below:
Getting the same result. $ kubectl logs -f vault-1 bank-vaults
time="2020-09-10T10:45:04Z" level=info msg="vault metrics exporter enabled: :9091/metrics" Anything else I need to consider? |
Took this to Slack, will post the outcome here. |
@gitdr could you please post your CR? It turned out to be that with Raft backend if the |
|
These are probably two unrelated issues here in the same thread:
|
The vault deployment is the only vault deployment on this test node. So there can not be any stale secrets volumes etc as every time the host is built from scratch via an automated process. It turned out that main vault gets OOM killed at regular intervals.
At some point error logs have stopped and vault gets unsealed again on every OOM kill.
(error messages continue) ...
(this is where it gets killed again)
|
I have the same Issue as the OP, basically my vault-2 pod doesn't start because key vault-unseal-5 is missing. |
@bonifaido Do we have a solution or fix for this issue. I am facing the same issue as @Centro1993 |
is there a fix for this? I'm getting the off by one error in my raft follower cluster. I feel like there is a silent error going on |
So I was able to solve this issue in follower mode by flattening my network and ensuring remote nodes were able to get bi-directional communication with the main cluster. |
+1 I am also facing this the first replica seems to create unseal keys 0-4 but the second one always wants the key 5 I orginally deployed 1 node as a POC and redeployed via the following process
CR Config:
Unseal replica 0
Error replica 1:
|
Looking at the it seems we just iterate on all keys from I will add some debug log to my instance to make sure that is what is happening but to me it looks like for some reason using the first It might be good to add a different error when |
So as @primeroz stated it is a raft issue. The first raft node would come up and the second one would not join and re try unsealing itself but in reality the first one already unsealed the vault server. Which means that the second pod is provisioning its own RAFT and not joining the first one. I got mine working by adding the following to my config above so that RAFT can be aware about what nodes there are.
env var:
You can see here in the vault docs that The examples within this repo here are very old and some incorrect the one using more than 3 replicas is setting Links: |
can someone please tell how you solved this issue. |
do you find a way to solve it? |
I switched to my own solution: https://github.com/camaeel/vault-k8s-helper/ For bank vaults I noticed that scaling first to 1 pod and then to 3 helped it to initialize properly. |
Is there a solution for this yet? I'm running into this problem and am blocked on a project. I'm curious what people do to get around it. For some reason, its trying to get vault unseal key 5 when there are only keys 0-4 being generated. This is my config:
|
I fixed the problem. It appears my config block was incorrect. This fixed it:
|
Does anyone still require assistance regarding this? |
Describe the bug:
bank-vaults trying to retrieve unseal key with index that is out of range.
Expected behaviour:
Vault gets unsealed using keys is k8s secret.
Steps to reproduce the bug:
helm upgrade --install vault-operator banzaicloud-stable/vault-operator
kubectl apply -f https://github.com/banzaicloud/bank-vaults/blob/master/operator/deploy/cr.yaml
Additional context:
none
Environment details:
$ kubectl logs vault-0 bank-vaults
time="2020-08-26T14:28:24Z" level=error msg="error unsealing vault: unable to get key 'vault-unseal-5': key 'vault-unseal-5' is not present in secret: vault-unseal-keys"
time="2020-08-26T14:28:29Z" level=info msg="vault is sealed, unsealing"
time="2020-08-26T14:28:33Z" level=error msg="error unsealing vault: unable to get key 'vault-unseal-5': key 'vault-unseal-5' is not present in secret: vault-unseal-keys"
time="2020-08-26T14:28:38Z" level=info msg="vault is sealed, unsealing"
time="2020-08-26T14:28:40Z" level=error msg="error unsealing vault: unable to get key 'vault-unseal-5': key 'vault-unseal-5' is not present in secret: vault-unseal-keys"
time="2020-08-26T14:28:45Z" level=info msg="vault is sealed, unsealing"
Secret created by vault operator
$ kubectl get secret vault-unseal-keys -o yaml
apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/name: vault
vault_cr: vault
name: vault-unseal-keys
namespace: default
type: Opaque
data:
vault-root: cy5TWXRybHUzZDE5VGM0UktrdmRNWEVHNDU=
vault-test: dmF1bHQtdGVzdA==
vault-unseal-0: MGEzNWQxMjVmYzc1YTA0MGIxMmI3YmY5ZDdmMDY4Mzk5MDMzY2NlMjhjMjFlMzJkMTUzODc2NzUwMGZjNDc1MjZl
vault-unseal-1: ZmNmZTg3NjNhYjMzYTgxMTdkMzA0ZjhlNmIzOGZmOGNmNTUyM2YzZjY4MjAzYjMxZjk5ZDI2MzY3YTliZDllYjFk
vault-unseal-2: YWYwMzJiYmJlNmYxNjlkODNlOGFhN2Q0NGUwNzc5ODc2YmM2MzAzOWRhMTI5NGVlMjRhOGQzMDkxZTFkMjc0YTY1
vault-unseal-3: NDRmNWQxYjViMTYyNGZiY2EwNDA2NWYyNmZmYjZmM2IwMGNlN2Y3YWIyZWUzOWJhNDg2NzVkYjA1YjVjMDdlYzJk
vault-unseal-4: YzY5ZGJlZmZiZjZmMjg1NmM3M2EzNThiNDIzMmJiYWI2Mzg2ZmY1NzY3OTQ1NTQ1ZTA0ODc2ZTRmMzMwOTk1Yzlj
/kind bug
The text was updated successfully, but these errors were encountered: