Skip to content

Instantly share code, notes, and snippets.

@surjikal
Last active December 2, 2021 17:25
Show Gist options
  • Save surjikal/7f7cb8db96fb2f1ce21dddb10ec244d0 to your computer and use it in GitHub Desktop.
Save surjikal/7f7cb8db96fb2f1ce21dddb10ec244d0 to your computer and use it in GitHub Desktop.
AWS X-Ray on EKS Fargate

This helm chart can be used to deploy a standalone daemon for AWS X-Ray on EKS Fargate.

  • You'll need to create a service account called aws-xray.
  • This IAM role works well: arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess
  • You will have to update the value for eks.amazonaws.com/role-arn.

Once this is deployed, you can set the AWS_XRAY_DAEMON_ADDRESS to aws-xray:2000 in your other pods.

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}
replicas: 1
template:
metadata:
labels:
app: {{ .Release.Name }}
spec:
serviceAccountName: aws-xray
securityContext:
runAsUser: 1001
containers:
- name: {{ .Release.Name }}
image: public.ecr.aws/xray/aws-xray-daemon:latest
imagePullPolicy: IfNotPresent
command: ["/xray", "-t", "0.0.0.0:2000", "-b", "0.0.0.0:2000", "--local-mode", "--log-level", "debug"]
ports:
- containerPort: 2000
env:
- name: AWS_REGION
value: "us-east-1"
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
spec:
selector:
app: {{ .Release.Name }}
ports:
- name: trace-udp
port: 2000
protocol: UDP
- name: trace-tcp
port: 2000
protocol: TCP
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ .Release.Name }}
name: aws-xray
namespace: {{ .Release.Namespace }}
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::XXXXXXXXX:role/aws-xray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment