Car
Car

Reputation: 387

Consul/Registrator architecture - do I need a separate Consul agent on each VM?

I'm trying to use Consul and Registrator to pick up microservices in various VMs but I think I'm not quite getting something. I understand that Registrator auto-registers containers with Consul. So I was thinking that I'd have one VM that runs Consul, and then for each microservice I'd have a VM with Registrator + the microservice.

However, I'm unable to get Registrator to talk to the Consul agent in a separate VM. Looking more closely at suggested architecture, it seems that I need a separate Consul agent on each VM. Am I understanding that right? If so, why? Shouldn't Registrator just be able to forward the container info to a Consul agent on any VM?

Also, do I need to run Registrator on the VM with the Consul agent and servers?

Upvotes: 2

Views: 504

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53713

you need to have a consul agent on every VM that provides a service so it can communicate info with the consul server

This blog post has nice information :

Consul Architecture Every node that provides services to Consul runs a Consul agent. The agent is responsible for checking the health of the services on the node as well as for the node itself. The agents talk to one or more Consul servers

Registrator Agent Registrator agent can automatically register/deregisters services for ECS tasks or services based on published ports and metadata from the container environment variables defined in the ECS task definition

so the 2 are complementary and needed to be deployed for each service (name) you will deploy

Upvotes: 6

Related Questions