[英]How to register vault (Hashicorp-vault) as a service in consul (Hashicorp-consul), I am using kubernetes?
I'm running vault and consul as pods in kubernetes, while I'm checking consul catalog service
it shows consul
alone.我在 kubernetes 中将 vault 和 consul 作为 pod 运行,而我正在检查
consul catalog service
它仅显示consul
。
How can I register vault as a service
?如何将
vault as a service
注册vault as a service
?
I'd tried with the following link, but it didn't work.我曾尝试使用以下链接,但没有奏效。 https://learn.hashicorp.com/consul/getting-started/services
https://learn.hashicorp.com/consul/getting-started/services
For registering vault as a service you will have to do the following steps要将保管库注册为服务,您必须执行以下步骤
{"service": {"name": "vault", "tags": ["vault-tag"], "port": 8200}}
into it.{"service": {"name": "vault", "tags": ["vault-tag"], "port": 8200}}
写入其中。 Name it as vault.json
vault.json
consul services register vault.json
consul services register vault.json
Vault will automatically register with consul when using consul as a backend datastorage.当使用 consul 作为后端数据存储时,Vault 会自动向 consul 注册。 If you are using one of the other storage options you have 2 ways to do it:
如果您使用其他存储选项之一,则有两种方法可以做到:
If you have vault 1.4 or newer, you can add the following to the vault config to automatically register the vault service in consul如果您有 vault 1.4 或更高版本,您可以将以下内容添加到 vault 配置中以在 consul 中自动注册 vault 服务
service_registration "consul" {
address = "127.0.0.1:8500"
}
Assuming you are running vault with https on port 8200假设您在端口 8200 上使用 https 运行保管库
{
"service": {
"checks": [
{
"http": "https://vault1.example.com:8200/v1/sys/health",
"id": "port",
"interval": "10s",
"name": "vault running on port 8200",
"timeout": "1s"
}
],
"enable_tag_override": false,
"id": "vault",
"meta": {
"meta": "Vault"
},
"name": "vault",
"port": 8200,
"tags": []
}
}
Note This won't provide the dynamic tags like active
or standby
that you get automatically with the other options.注意这不会提供动态标签,如使用其他选项自动获得的
active
或standby
。 https://www.vaultproject.io/docs/configuration/service-registration/consul https://www.vaultproject.io/docs/configuration/service-registration/consul
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.