admin管理员组

文章数量:1404612

I'm following the Datadog setup for ECS with Fargate and using the task definition provided (.json), but while I'm able to see the cws-instrumentation-volume mount and the datadog-agent run, my app would not start with the /cws-instrumentation-volume/cws-instrumentation trace -- in the entryPoint. I tried a version where I left everything else in the task definition but simply removed the /cws-instrumentation-volume/cws-instrumentation trace -- line, and my app runs successfully (but without any Datadog events sending as expected).

What am I doing wrong here?

{
"family": "my-task-name",
"cpu": "4096",
"memory": "8192",
"networkMode": "awsvpc",
"pidMode": "task",
"requiresCompatibilities": [
  "FARGATE"
],
"taskRoleArn": "my-task-role-arn",
"executionRoleArn": "my-execution-role-arn",
"containerDefinitions": [
  {
    "name": "cws-instrumentation-init",
    "image": "datadog/cws-instrumentation:latest",
    "cpu": 128,
    "memory": 128,
    "essential": false,
    "user": "0",
    "command": [
      "/cws-instrumentation",
      "setup",
      "--cws-volume-mount",
      "/cws-instrumentation-volume"
    ],
    "mountPoints": [
      {
        "sourceVolume": "cws-instrumentation-volume",
        "containerPath": "/cws-instrumentation-volume",
        "readOnly": false
      }
    ],
    "logConfiguration": {
      "logDriver": "awslogs",
      "options": {
        "awslogs-group": "/ecs/cws-instrumentation-init",
        "mode": "non-blocking",
        "awslogs-create-group": "true",
        "max-buffer-size": "25m",
        "awslogs-region": "us-west-2",
        "awslogs-stream-prefix": "ecs"
      }
    }
  },
  {
    "name": "datadog-agent",
    "image": "datadog/agent:latest",
    "cpu": 256,
    "memory": 512,
    "essential": true,
    "environment": [
      {
        "name": "DD_API_KEY",
        "value": "my-dd-api-key"
      },
      {
        "name": "DD_SITE",
        "value": "datadoghq"
      },
      {
        "name": "ECS_FARGATE",
        "value": "true"
      },
      {
        "name": "DD_RUNTIME_SECURITY_CONFIG_ENABLED",
        "value": "true"
      },
      {
        "name": "DD_RUNTIME_SECURITY_CONFIG_EBPFLESS_ENABLED",
        "value": "true"
      }          
    ],
    "healthCheck": {
        "command": [
            "CMD-SHELL",
            "/probe.sh"
        ],
        "interval": 30,
        "timeout": 5,
        "retries": 2,
        "startPeriod": 60
    },
    "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/datadog-agent",
          "mode": "non-blocking",
          "awslogs-create-group": "true",
          "max-buffer-size": "25m",
          "awslogs-region": "us-west-2",
          "awslogs-stream-prefix": "ecs"
        }
    }
  },
  {
    "name": "my-app-container",
    "image": "my-app-container-ecr-image",
    "cpu": 3712,
    "memory": 7552,
    "portMappings": [
      {
        "name": "3000",
        "containerPort": 80,
        "hostPort": 80,
        "protocol": "tcp",
        "appProtocol": "http"
      }
    ],
    "essential": true,
    "environment": [],
    "entryPoint": [
      "/cws-instrumentation-volume/cws-instrumentation",
      "trace",
      "--",
      "uvicorn app.main:app --host 0.0.0.0 --port 80 --proxy-headers"
    ],
    "mountPoints": [
      {
        "sourceVolume": "cws-instrumentation-volume",
        "containerPath": "/cws-instrumentation-volume",
        "readOnly": true
      }
    ],
    "volumesFrom": [],
    "linuxParameters": {
      "capabilities": {
        "add": [
          "SYS_PTRACE"
        ]
      }
    },
    "secrets": [
       ...
    ],
    "dependsOn": [
      {
        "containerName": "datadog-agent",
        "condition": "HEALTHY"
      },
      {
        "containerName": "cws-instrumentation-init",
        "condition": "SUCCESS"
      }
    ],
    "logConfiguration": {
      "logDriver": "awslogs",
      "options": {
        "awslogs-group": "my-awslogs-group",
        "mode": "non-blocking",
        "awslogs-create-group": "true",
        "max-buffer-size": "25m",
        "awslogs-region": "us-west-2",
        "awslogs-stream-prefix": "ecs"
      }
    },
    "systemControls": []
  }
],
"volumes": [
  {
    "name": "cws-instrumentation-volume"
  }
]

}

本文标签: amazon ecsDatadog agent with ECS Fargate does not run with cwsinstrumentationvolumeStack Overflow