-
Make sure to first have a working Jaeger in the cluster: https://gist.github.com/joaopgrassi/8eb001d94310effef038364e4f6994ab
-
Run the following command to deploy the collector in your k8s cluster:
Note: The yml below expects the Jaeger services to be deployed within the
observability
using the names from the gist above. If you follow that it should all work. If not, make sure the dns names are the correct.
kubectl apply -n observability -f <<EOF
---
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-conf
namespace: observability
labels:
app: opentelemetry
component: otel-collector-conf
data:
otel-collector-config: |
receivers:
otlp:
protocols:
grpc:
http:
processors:
exporters:
logging:
jaeger:
endpoint: "simplest-collector-headless.observability:14250"
insecure: "true"
service:
pipelines:
traces:
receivers: [otlp]
processors: []
exporters: [logging, jaeger]
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
namespace: observability
labels:
app: opentelemetry
component: otel-collector
spec:
ports:
- name: otlpgrpc # Default endpoint for OpenTelemetry gRPC receiver.
port: 4317
protocol: TCP
targetPort: 4317
- name: otlphttp # Default endpoint for OpenTelemetry HTTP receiver.
port: 4318
protocol: TCP
targetPort: 4318
selector:
component: otel-collector
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
namespace: observability
labels:
app: opentelemetry
component: otel-collector
spec:
replicas: 1
selector:
matchLabels:
app: opentelemetry
component: otel-collector
template:
metadata:
labels:
app: opentelemetry
component: otel-collector
spec:
containers:
- name: otel-collector
args:
- --config=/conf/otel-collector-config.yaml
image: otel/opentelemetry-collector:0.33.0
ports:
- containerPort: 4317
- containerPort: 4318
volumeMounts:
- name: otel-collector-config-vol
mountPath: /conf
# - name: otel-collector-secrets
# mountPath: /secrets
volumes:
- configMap:
name: otel-collector-conf
items:
- key: otel-collector-config
path: otel-collector-config.yaml
name: otel-collector-config-vol
EOF