Skip to content

Commit

Permalink
Merge pull request #8 from stefanprodan/jaeger
Browse files Browse the repository at this point in the history
Add X-Ray, Jaeger and Datadog tracing to App Mesh Inject
  • Loading branch information
nckturner authored Oct 18, 2019
2 parents 4bc9955 + de8be61 commit 26bcbea
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 8 deletions.
102 changes: 99 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ kubectl apply -f https://raw.githubusercontent.com/aws/eks-charts/master/stable/
Install the App Mesh CRD controller:

```sh
helm upgrade -i appmesh-controller eks/appmesh-controller --namespace appmesh-system
helm upgrade -i appmesh-controller eks/appmesh-controller \
--namespace appmesh-system
```

Install the App Mesh admission controller:
Expand Down Expand Up @@ -59,17 +60,112 @@ you can proceed with the Helm installation as described above.

### App Mesh add-ons

#### Prometheus monitoring

Install App Mesh Prometheus:

```sh
helm upgrade -i appmesh-prometheus eks/appmesh-prometheus \
--namespace appmesh-system
```

Access Prometheus UI on `localhost:9090` with:

```sh
kubectl -n appmesh-system port-forward svc/appmesh-prometheus 9090:9090
```

To retain the monitoring data between chart upgrades or node restarts, you can create a
[PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims):

```yaml
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prometheus
namespace: appmesh-system
labels:
app.kubernetes.io/name: appmesh-prometheus
spec:
storageClassName: gp2
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
EOF
```

Install Prometheus with persistent storage:

```sh
helm upgrade -i appmesh-prometheus eks/appmesh-prometheus \
--namespace appmesh-system \
--set retention=6h
--set retention=12h \
--set persistentVolumeClaim.claimName=prometheus
```

#### AWS X-Ray

Enable X-Ray tracing for the App Mesh data plane:

```sh
helm upgrade -i appmesh-inject eks/appmesh-inject \
--namespace appmesh-system \
--set tracing.enabled=true \
--set tracing.provider=x-ray
```

The above configuration will inject the AWS X-Ray daemon sidecar in each pod scheduled to run on the mesh.
**Note** that you should restart all pods running inside the mesh after enabling tracing.

#### Jaeger tracing

Install App Mesh Jaeger:

```sh
helm upgrade -i appmesh-jaeger eks/appmesh-jaeger \
--namespace appmesh-system
```

For Prometheus persistent storage you should create a [PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)
For Jaeger persistent storage you can create a [PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)
and use `--set persistentVolumeClaim.claimName=<PVC-CLAIM-NAME>`.

Access Jaeger UI on `localhost:16686` with:

```sh
kubectl -n appmesh-system port-forward svc/appmesh-jaeger 16686:16686
```

Enable Jaeger tracing for the App Mesh data plane:

```sh
helm upgrade -i appmesh-inject eks/appmesh-inject \
--namespace appmesh-system \
--set tracing.enabled=true \
--set tracing.provider=jaeger \
--set tracing.address=appmesh-jaeger.appmesh-system \
--set tracing.port=9411
```

**Note** that you should restart all pods running inside the mesh after enabling tracing.

#### Datadog tracing

Install the Datadog agent in the `appmesh-system` namespace and enable tracing for the App Mesh data plane:

```sh
helm upgrade -i appmesh-inject eks/appmesh-inject \
--namespace appmesh-system \
--set tracing.enabled=true \
--set tracing.provider=datadog \
--set tracing.address=datadog.appmesh-system \
--set tracing.port=8126
```

**Note** that you should restart all pods running inside the mesh after enabling tracing.

## License

This project is licensed under the Apache-2.0 License.
Expand Down
4 changes: 2 additions & 2 deletions stable/appmesh-inject/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: appmesh-inject
description: AWS App Mesh Inject Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: 0.1.6
version: 0.2.0
appVersion: 0.2.0
13 changes: 13 additions & 0 deletions stable/appmesh-inject/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ spec:
- -sidecar-cpu-requests={{ .Values.sidecar.resources.requests.cpu }}
- -sidecar-memory-requests={{ .Values.sidecar.resources.requests.memory }}
- -init-image={{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}
{{- if and .Values.tracing.enabled ( eq .Values.tracing.provider "x-ray" ) }}
- -inject-xray-sidecar=true
{{- end }}
{{- if and .Values.tracing.enabled ( eq .Values.tracing.provider "jaeger" ) }}
- -enable-jaeger-tracing=true
- -jaeger-address={{ .Values.tracing.address }}
- -jaeger-port={{ .Values.tracing.port }}
{{- end }}
{{- if and .Values.tracing.enabled ( eq .Values.tracing.provider "datadog" ) }}
- -enable-datadog-tracing=true
- -datadog-address={{ .Values.tracing.address }}
- -datadog-port={{ .Values.tracing.port }}
{{- end }}
ports:
- name: https
containerPort: 8080
Expand Down
16 changes: 13 additions & 3 deletions stable/appmesh-inject/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ replicaCount: 1

image:
repository: 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon/aws-app-mesh-inject
tag: v0.1.6
tag: v0.2.0
pullPolicy: IfNotPresent

sidecar:
image:
repository: 111345817488.dkr.ecr.us-west-2.amazonaws.com/aws-appmesh-envoy
tag: v1.11.1.0-prod
repository: 840364872350.dkr.ecr.us-west-2.amazonaws.com/aws-appmesh-envoy
tag: v1.11.2.0-prod
# sidecar.logLevel: Envoy log level can be info, warn or error
logLevel: info
resources:
Expand Down Expand Up @@ -61,3 +61,13 @@ mesh:
name: "global"
# mesh.discovery: The service discovery type to use, can be dns or cloudmap
discovery: dns

tracing:
# tracing.enabled: `true` if Envoy should be configured tracing
enabled: false
# tracing.provider: can be x-ray, jaeger or datadog
provider: x-ray
# tracing.address: Jaeger or Datadog agent server address (ignored for X-Ray)
address: appmesh-jaeger.appmesh-system
# tracing.address: Jaeger or Datadog agent server port (ignored for X-Ray)
port: 9411
21 changes: 21 additions & 0 deletions stable/appmesh-jaeger/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
6 changes: 6 additions & 0 deletions stable/appmesh-jaeger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: appmesh-jaeger
description: AWS App Mesh Jaeger Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: 1.14.0
3 changes: 3 additions & 0 deletions stable/appmesh-jaeger/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AWS App Mesh Jaeger installed!
Jaeger UI port: 16686
Jaeger Zipkin port: 9411
56 changes: 56 additions & 0 deletions stable/appmesh-jaeger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "appmesh-jaeger.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "appmesh-jaeger.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "appmesh-jaeger.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "appmesh-jaeger.labels" -}}
app.kubernetes.io/name: {{ include "appmesh-jaeger.name" . }}
helm.sh/chart: {{ include "appmesh-jaeger.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "appmesh-jaeger.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "appmesh-jaeger.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
8 changes: 8 additions & 0 deletions stable/appmesh-jaeger/templates/account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "appmesh-jaeger.serviceAccountName" . }}
labels:
{{ include "appmesh-jaeger.labels" . | indent 4 }}
{{- end }}
101 changes: 101 additions & 0 deletions stable/appmesh-jaeger/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "appmesh-jaeger.fullname" . }}
labels:
{{ include "appmesh-jaeger.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: {{ include "appmesh-jaeger.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "appmesh-jaeger.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "14269"
spec:
serviceAccountName: {{ include "appmesh-jaeger.serviceAccountName" . }}
volumes:
- name: data
{{- if .Values.persistentVolumeClaim.claimName }}
persistentVolumeClaim:
claimName: {{ .Values.persistentVolumeClaim.claimName }}
{{- else }}
emptyDir: {}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
# agent: accept zipkin.thrift over compact thrift protocol (deprecated, used by legacy clients only)
- containerPort: 5775
protocol: UDP
# agent: accept jaeger.thrift over compact thrift protocol
- containerPort: 6831
protocol: UDP
# agent: accept jaeger.thrift over binary thrift protocol
- containerPort: 6832
protocol: UDP
# collector: Zipkin compatible endpoint
- containerPort: 9411
protocol: TCP
# query: serve frontend
- containerPort: 16686
protocol: TCP
# agent: serve configs
- containerPort: 5778
protocol: TCP
# collector: accept jaeger.thrift directly from clients
- containerPort: 14268
protocol: TCP
# collector: Health Check server
- containerPort: 14269
protocol: TCP
env:
- name: MEMORY_MAX_TRACES
value: "{{ .Values.memory.maxTraces }}"
- name: COLLECTOR_ZIPKIN_HTTP_PORT
value: "9411"
- name: BADGER_EPHEMERAL
value: "false"
- name: SPAN_STORAGE_TYPE
value: "badger"
- name: BADGER_DIRECTORY_VALUE
value: "/badger/data"
- name: BADGER_DIRECTORY_KEY
value: "/badger/key"
- name: QUERY_BASE_PATH
value: /jaeger
livenessProbe:
httpGet:
path: /
port: 14269
readinessProbe:
httpGet:
path: /
port: 14269
volumeMounts:
- name: data
mountPath: /badger
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
Loading

0 comments on commit 26bcbea

Please sign in to comment.