HOW TO migrate vault backend from postgres to raft

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

we have vault with backend = postgres and efs volume for plugin


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

lets check secrets in vault UI

delete helm chart

helm delete -n vault-test vault-test

apply new chart with raft

terraform apply --target helm_release.vault_test

Wait until Terraform apply does not timeout.

check and we will see that vault pod run but not ready

go to the zero pod

create migration file

cat > migrate.hcl

delete directory raft and file  vault.db

run migration

vault operator migrate -config=migrate.hcl

if we see message like this:

all ok.

now we will run terraform apply again

terraform apply --target helm_release.vault_test

say yes

helm chart will be delete and after create again

check vault with raft

block zero pod

check from another pod

kubectl exec -ti -n vault-test vault-test-2 sh
/ $ vault login

as we see vault-0 disable and leader bacome vault-1

now check vault UI

ok now we will return vault-0