Consul service definition json is as follows
{
"Address": "192.168.10.10",
"TaggedAddresses": {
"lan": "192.168.10.10",
"wan": "10.0.10.10"
},
"CreateIndex": 51,
"ModifyIndex": 51,
"Node": "foobar",
"ServiceAddress": "172.17.0.3",
"ServiceEnableTagOverride": false,
"ServiceID": "32a2a47f7992:nodea:5000",
"ServiceName": "foobar",
"ServicePort": 5000,
"ServiceTags": [
"tacos"
]
}
Now as per the documentation provided at https://www.consul.io/docs/agent/http/catalog.html#catalog_service
the definition of address and service address is as follows:
A. Does this mean Address is the address of consul server node and service address is address of the node where service resides?
OR
B. Does this mean Address is the address of consul agent residing with the service. If this is the case does this mean address and service address are same?
which of the above is correct?
Consul is the control plane of the service mesh. Consul is a multi-networking tool that offers a fully-featured service mesh solution that solves the networking and security challenges of operating microservices and cloud infrastructure. Consul offers a software-driven approach to routing and segmentation.
By default, the Consul agent runs a DNS server listening on port 8600. By submitting DNS requests to the Consul agent's DNS server, you can get the IP address of a node running the service in which you are interested. The Consul DNS interface makes the port information for a service available via the SRV records.
Consul is a service mesh solution that offers a software-driven approach to: Security (mTLS & ACLs) Observability. Traffic management.
One of the major use cases for Consul is service discovery. Consul provides a DNS interface that downstream services can use to find the IP addresses of their upstream dependencies. Consul knows where these services are located because each service registers with its local Consul client.
Consul can load service definitions saved as .json or .hcl files. Send a SIGHUP to the running agent or use consul reload to check for new service definitions or to update existing services. Alternatively, the service can be registered dynamically using the HTTP API.
Internal services are those provided by nodes where the Consul agent can run directly. They are registered with service definitions via the local Consul agent. The local Consul agent on the node is responsible for running any health checks registered for the service and updating the catalog accordingly.
They must be registered directly with the catalog because, by definition, they don't have a local Consul agent to register with. Both internal and external services can have health checks associated with them. Health checking in Consul uses a push-based model where agents send events only upon status changes.
Service Address: The service address is where you will primarily be using the phone. This can be the same as your billing address, or it can be different. Billing Address: The billing address is the address associated with your credit card—it is used to verify your credit card information.
I suppose, that Address is the address of consul agent and ServiceAddress is the address which is used to access this service. This can be the same addresses, but they can also differ.
For example, you can have a single host with a number of interfaces, one of them is used to make Consul agents interact with each other, and another one is used to access your service.
Or you can have a single node with a number of microservices deployed with Docker. You can start a single Consul Agent with this node's address, and register a number of microservices running in containers and communicated with each other by container inner IP-addresses. In that case, you will get service info where Address is equals to node's IP and ServiceAddress is equals to the IP of the container with service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With