Search code examples
javaspringspring-boothashicorp-vaultspring-vault

Is it possible to use HashiCorp Vault with redundancy in a Spring Boot application?


I set up a vault cluster with two vault servers. One server is active and other one is in standby mode at a time as an expected behaivour. I can access each of them from my spring boot application with configuration in bootstrap.properties as shown below:

spring.cloud.vault.authentication=token
spring.cloud.vault.token=xxxxxxxxxxxxxxxxxxx
spring.cloud.vault.scheme=http

spring.cloud.vault.generic.backend=my-config

spring.cloud.vault.host=ip_address_of_one of_the_vault_servers
spring.cloud.vault.port=8200

But if the vault service which is defined in bootstrap.properties is down, I cannot access vault. So it is meaningless to have more than one vault server and using vault in HA mode.

I just want to use two vault server for redundancy in my spring boot application. How can it be possible?

Note: I cannot define host like this: spring.cloud.vault.host= ip_addr1,ip_addr2

Note2: I use postgresql as secret backend in HA mode.


Solution

  • It seeems there is no way to do that with just spring cloud according to this documentation.

    The part about that is:

    Important: The Spring Cloud Services Config Server supports only one Vault backend, so only one vault object is permitted in the configuration parameters.