Last update: Feb 22, 2021
The etcd Service Discovery integration allows you to perform the host resolution using your existing etcd setup.
The integration etcd is controlled by the krakend-etcd component and adds client and subscriber capabilities for etcd.
To enable the integration add in the root of your configuration file the necessary settings:
{
"version": 2,
"extra_config": {
"github_com/devopsfaith/krakend-etcd": {
"machines": [
"https://192.168.1.100:4001",
"https://192.168.1.101:4001"
],
"dial_timeout": "5s",
"dial_keepalive": "30s",
"header_timeout": "1s",
"cert": "/path/to/cert",
"key": "/path/to/cert-private-key",
"cacert": "/path/to/CA-cert"
}
},
...
The only mandatory key inside the github_com/devopsfaith/krakend-etcd
namespace is machines
, so the integration knows where etcd lives. The rest of the keys in the configuration are optional.
The timeouts and keepalive will take the shown values if the keys are missing, and the certificates (cert
, key
, and cacert
) are not needed if you use plain connections.
Now you are able to use etcd
with your backends.
Once the integration has been enabled, add the following keys in the backend
section of your configuration. The host
key can be skipped if there is another host
key in the root level of the configuration.
"sd": "etcd"
: To set etcd as the service discovery"host": []
: The list of all the services you want to resolveFor instance, set the service discovery for an individual backend:
...
"backend": [
{
"url_pattern": "/foo",
"sd": "etcd",
"host": [
"api-catalog"
],
"disable_host_sanitize": true
}
]
...
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.
We use cookies to understand how you use our site and to improve your overall experience. By continuing to use our site, you accept our Privacy Policy. More information