Closed cs-mahmoud-khateeb closed 6 years ago
Documenting some of the conversation from gitter for others that may see this issue...
In the first case it appears to be an options passing/parsing problem with AWS and consul/go-discover is seeing the entire retry-join
as one string and attempting to parse it all as the provider.
Additionally, it should be tag_key
and tag_value
instead of tag_name
and tag_value
in the discovery string.
closing as per above.
for the AWS issue, no need to use double quotes.
awesome, simple enough :)
for posterity
When used in a command block in an AWS ECS task-definition, it should be: (although it looks weird)
# task-definition.json
{
"containerDefinitions": [
{
"command": [
"agent",
"-server",
"-retry-join=provider=aws tag_key=foo tag_value=bar"
],
...
Thanks @ebarault . Your comment saved me hours of debugging.
I am trying to start three Consul servers in an ECS cluster that consist of three ec2 instances, each in a different availabity zone within one aws region.
the command I am using in my task definition:
agent,-server,-client=0.0.0.0,-bootstrap-expect=3,-datacenter=eu-west-1,-retry-join="provider=aws tag_name=aws:autoscaling:groupName tag_value=ecs_cluster",-log-level=TRACE
and I am getting the following log in all three instances (it worth mentioning that the task definitioin has an IAM role with the abiltiy to DescribeInstances:
I have tried the following to make sure everything is fine:
I have tried to ssh directly to the container instances and run the following command (with aws key):
docker run --net=host -e 'CONSUL_BIND_INTERFACE=eth0' consul agent -server -client=0.0.0.0 -bootstrap-expect=3 -datacenter=eu-west-1 -retry-join="provider=aws tag_name=Name tag_value=ecs_cluster access_key_id=x secret_access_key=x" -log-level=TRACE
and I got slightly different output:
It worth mentioning that the aws key used in the command hasn't been used according to IAM.
I was able to get around this by running:
consul join x.x.x.x
inside the containers.