【发布时间】:2020-08-28 05:44:27
【问题描述】:
我正在开发一个示例应用程序,我想在其中连接到 Hashicorp 保险库以获取数据库凭据。下面是我的应用程序的 bootstrap.yml。
spring:
application:
name: phonebook
cloud:
config:
uri: http://localhost:8888/
vault:
uri: http://localhost:8200
authentication: token
token: s.5bXvCP90f4GlQMKrupuQwH7C
profiles:
active:
- local,test
当保管库服务器解封时,应用程序会正确构建。 Maven 正确地从 Vault 中获取数据库用户名。当我在密封保管库后运行构建时,由于以下错误,构建失败。
org.springframework.vault.VaultException: Status 503 Service Unavailable [secret/application]: error performing token check: Vault is sealed; nested exception is org.springframework.web.client.HttpServerErrorException$ServiceUnavailable: 503 Service Unavailable: [{"errors":["error performing token check: Vault is sealed"]}
我该如何解决这个问题?我希望 maven 在构建过程中获取数据库用户名和密码,即使保险库是密封的,也不会出现任何问题。
【问题讨论】:
-
密封 Vault 的全部目的是禁止所有 api 调用。让电话通过的唯一方法是打开它。调查它被密封的原因,并采取措施尽可能保持它不密封(多节点、自动解封、调查崩溃等...)
-
我手动密封的。那么,我是否应该在运行应用程序时始终保持保险库未密封?
-
根据文档
Prior to unsealing, almost no operations are possible with Vault。参考vaultproject.io/docs/concepts/seal
标签: spring-boot spring-cloud-config hashicorp-vault spring-cloud-vault-config