Skip to content

Commit 848d1db

Browse files
committed
add kubernetes example
1 parent 32e7fd6 commit 848d1db

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Tails is primarily used as a sidecar to your collector. The goal of Tails is to
2020

2121
> NOTE: Make sure to use the appropriate docker container for your environment (currently an amd and arm image are published)
2222
23+
For example usage in Kubernetes, visit the example [here](examples/kubernetes/README.md)
24+
2325
## Collector configuration
2426

2527
At a minimum for tails to function, you must use the [remotetap processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/remotetapprocessor) in your collector's configuration. Tails expects to connect to the collector's remotetap processor on _port 12001_ (this will be configurable in the future). It is also recommended to use the [opampextension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/opampextension) so that you can view the health and configuration for your collector. Here's a minimum sample configuration for a collector with these configured (tested with version 0.97.0 of the collector):

examples/kubernetes/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Kubernetes Walkthrough
2+
3+
To get started with tails, you'll need at least the remotetap processor and optionally the opamp extension. You can view the collector.yaml file for a complete example YAML file that works with the OpenTelemetry Operator, this will also work with a non-operator collector.
4+
5+
> [!NOTE]
6+
> Be sure you are using at least collector version 0.103.0
7+
8+
## Add Remote Tap Processor
9+
10+
```yaml
11+
processors:
12+
remotetap:
13+
endpoint: localhost:12001
14+
```
15+
16+
## (Optional) Add OpAMP Extension
17+
18+
```yaml
19+
extensions:
20+
opamp:
21+
server:
22+
ws:
23+
endpoint: ws://127.0.0.1:4000/v1/opamp
24+
tls:
25+
insecure: true
26+
```
27+
28+
## Update service pipeline(s)
29+
30+
The remote tap processor's placement in the pipeline is important. If you want to see all the un-filtered data put it first in the pipeline. If you want to see the data post-filtering and enrichment put it last.
31+
32+
```yaml
33+
service:
34+
extensions: [opamp]
35+
pipelines:
36+
traces:
37+
processors: [..., remotetap]
38+
```
39+
40+
## Add the additional tails container
41+
42+
> [!WARNING]
43+
> It's recommended to replace the SECRET_KEY_BASE with a randomly generated 64 byte string. You can do this with `openssl rand -base64 64`
44+
45+
```yaml
46+
additionalContainers:
47+
- name: tails
48+
image: ghcr.io/jaronoff97/tails:v0.0.8
49+
env:
50+
- name: SECRET_KEY_BASE
51+
value: nErlTbssfnJxvjjujVKgDO/q84XAggf6/kN6b926qjRFK+uasVyd/+oACdXLm38l
52+
ports:
53+
- containerPort: 4000
54+
```
55+
56+
## Apply your new config
57+
58+
Apply the configuration either via `kubectl apply -f <file>` or with helm.
59+
60+
## Port forward to view the UI
61+
62+
```bash
63+
kubectl port-forward pod/<collector-pod> 4000:4000
64+
```
65+
66+
You should now be able to visit http://localhost:4000

examples/kubernetes/collector.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: opentelemetry.io/v1beta1
2+
kind: OpenTelemetryCollector
3+
metadata:
4+
name: tails-example
5+
spec:
6+
image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.103.0
7+
additionalContainers:
8+
- name: tails
9+
image: ghcr.io/jaronoff97/tails:v0.0.8
10+
env:
11+
- name: SECRET_KEY_BASE
12+
value: agbCd+/i9v3Ep8D6HPZVTN+ukg+dzZbOkrdgbBCC+P8nLzDUhihMv/fdF2Nz30lX
13+
ports:
14+
- containerPort: 4000
15+
config:
16+
extensions:
17+
opamp:
18+
server:
19+
ws:
20+
endpoint: ws://127.0.0.1:4000/v1/opamp
21+
tls:
22+
insecure: true
23+
receivers:
24+
otlp:
25+
protocols:
26+
grpc: {}
27+
http: {}
28+
processors:
29+
remotetap:
30+
endpoint: localhost:12001
31+
batch:
32+
send_batch_size: 10000
33+
timeout: 10s
34+
35+
exporters:
36+
debug: {}
37+
38+
service:
39+
extensions: [opamp]
40+
pipelines:
41+
traces:
42+
receivers: [otlp]
43+
processors: [remotetap, batch]
44+
exporters: [debug]

0 commit comments

Comments
 (0)