简体   繁体   中英

AWS X-RAY [Error] Sending segment batch failed with: NoCredentialProviders: no valid providers in chain. Deprecated

I'm using X-Ray Daemon with Fargate. Unfortunately in the logs of the daemon I see errors like:

[Error] Sending segment batch failed with: NoCredentialProviders: no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors Warn] Delaying sending of additional batches by 0 seconds

AWS X-Ray works with IAM: permission: AWSXrayFullAccess

I already checked:

{
 "name" : "xray-daemon",
 "image" : "amazon/aws-xray-daemon",
 "user" : "1337",
 "essential" : true,
 "cpu" : "32",
 "memoryReservation" : "256",
 "portMappings" : [
 {
 "containerPort" : 2000,
 "protocol" : "udp"
 }
 ]
 }
 ],
 "requiresCompatibilities" : [ "FARGATE" ],
 "taskRoleArn" : "arn:aws:iam::123456789012:role/ecsTaskRole",
 "executionRoleArn" : "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
 "networkMode" : "awsvpc"
} 

You should check you role permissions role, I used the same for execution & taskRoleArn. my role contained these policies

  • arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
  • arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
  • arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
  • arn:aws:iam::aws:policy/AWSXRayFullAccess

and also check trust relationships for role. my used:

  • ecs-tasks.amazonaws.com
  • ecs.amazonaws.com
  • c2.amazonaws.com

I got this error when my version of the x-ray deamon was old.

Follow this as guidance to update your x-ray deamon if it is running on ECS:

https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-ecs.html

XRay daemon is missing credentials needed to authenticate with XRay server. You can pass credentials to XRay daemon in several ways, but the most common are:

  1. through environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  2. through ~/.aws/credentials file (see https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html )

I'm guessing option 1 will be easier with fargate.

Of course you need to generate the key in IAM, see: https://docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html

The user you'll create the access key for will need to have permissions to use XRay (AWSXrayFullAccess should do).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM