HOW TO migrate vault backend file to postgres

Thank you for reading this post, don't forget to subscribe!

we have vault with backend file

check data in vault

Now we need to create the database.

create database vault;
CREATE USER vault WITH PASSWORD 'fdgsdfkgh34098fsd';
GRANT ALL PRIVILEGES ON DATABASE vault TO vault;
ALTER DATABASE vault OWNER TO vault;

switch to database vault:
\c vault

now create migration file

kubectl exec -ti -n vault-test vault-test-0 sh
cd /vault/data/

cat > migrate.hcl

run migration

vault operator migrate -config=migrate.hcl

if we see

all ok.

Now we can delete this helm chart, and pvc

terraform destroy --target helm_release.vault_test

kubectl delete pvc -n vault-test audit-vault-test-0 data-vault-test-0

apply helm chart with backend postgresql

terraform apply --target helm_release.vault_test

lets check

kubectl exec -ti -n vault-test vault-test-0 sh

 

 

all ok