aws / amazon-ecs-agent

Amazon Elastic Container Service Agent

Home Page:http://aws.amazon.com/ecs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run task failed

DorrinPk opened this issue · comments

When I run my task with syslog or awslogs as logging options, I don't get any errors and it works just fine.

But when I change it to 'flunetd', I get : Run task failed. Reasons : ["ATTRIBUTE"]

I'm using the ECS AMI and the docker version is 1.11.2

@DorrinPk The fluentd logging driver is not enabled by default on the ECS AMI. You'd have to configure it via userdata if launching a new instance or manually login to the instance and edit the ECS Agent Config File and restart the Agent so that the Agent registers itself with this capability.

@aaithal I still get the same error after manually updating my userdata and updating the agents from the console.

I thought the point of using the drop down and choosing fluentd is to not have to play around with userdata. I don't have to edit the userdata for syslog or awslogs?

@DorrinPk can you please paste the userdata string that you're using?

I thought the point of using the drop down and choosing fluentd is to not have to play around with userdata. I don't have to edit the userdata for syslog or awslogs?

When you create the task definition, you add constraints on the task, one which is needing fluentd logging driver. By default, if using the ECS Optimized AMI, the ECS Agent is registered with json-file, syslog and awslogs logging drivers. We have had other feature requests (#454) for enabling other logging drivers by default. We are still debating about how to approach that issue.

@aaithal : the userdata is : ECS_AVAILABLE_LOGGING_DRIVERS='["awslogs","fluentd"]'

and I am using the ECS AMI.

@aaithal : I also see this in my event logs:

service xxxx was unable to place a task because no container instance met all of its requirements. The closest matching container-instance xxxxxxxxx is missing an attribute required by your task. For more information, see the Troubleshooting section.

@DorrinPk can you please paste the relevant part of your user-data script (including the #!/bin/bash directive and the part where you are overriding the ecs.config file)? You can also email the container instance arn/ec2 instance id and the region where you're launching this to aithal at amazon dot com. I suspect there's an issue in creating the config file that's leading to this. Here are the steps that I followed to register my container instance with fluentd logging driver:

  • Launch an EC2 Instance using the ECS Optimized AMI with user-data:
#!/bin/bash
echo ECS_LOGLEVEL=debug >> /etc/ecs/ecs.config
echo ECS_AVAILABLE_LOGGING_DRIVERS='["awslogs","fluentd"]' >> /etc/ecs/ecs.config
  • Login to the instance and verify that the ecs.config file is properly configured:
$ cat /etc/ecs/ecs.config
ECS_LOGLEVEL=debug
ECS_AVAILABLE_LOGGING_DRIVERS=["awslogs","fluentd"]
  • Describe the instance to verify that it's been registered with the fluentd capability:
$ aws ecs describe-container-instances --container-instance xxx --query 'containerInstances[0].attributes'
[
    {
        "name": "com.amazonaws.ecs.capability.privileged-container"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.20"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.22"
    },
    {
        "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
    },
    {
        "name": "com.amazonaws.ecs.capability.logging-driver.fluentd"
    },
    {
        "name": "com.amazonaws.ecs.capability.ecr-auth"
    },
    {
        "name": "com.amazonaws.ecs.capability.task-iam-role"
    },
    {
        "name": "com.amazonaws.ecs.capability.task-iam-role-network-host"
    }
]

Yes, once the fluentd driver is specified in ecs config and the fluentd is installed as a service, it works.