@@ -50,12 +50,14 @@ OpenTelemetry 接收 SkyWalking 数据存在 Bug,最近我们在 [#11562](http
5050
5151## 配置 OpenTelemetry 接收 SkyWalking 数据
5252
53- 我们假设 OpenTelemetry 所在的命名空间为 ` open-telemetry ` ,假设 otel-agent 使用的 ConfigMap 名为 ` otel-agent-conf ` ,使用如下命令修改 otel-agent 配置:
53+ 在[ 背景知识] ( #背景知识 ) 一节中,安装好 OpenTelemetry 之后,我们可以使用如下步骤配置 OpenTelemetry 接收 SkyWalking 数据:
54+
55+ 假设 OpenTelemetry 所在的命名空间为 ` open-telemetry ` ,假设 otel-agent 使用的 ConfigMap 名为 ` otel-agent-conf ` ,使用如下命令修改 otel-agent 配置:
5456``` bash
5557kubectl -n open-telemetry edit cm otel-agent-conf
5658```
5759
58- 在 ` receivers ` 和 ` service.pipelines.traces ` 两节中 ,增加如下内容:
60+ 在 ` receivers ` 一节中 ,增加如下内容:
5961``` yaml
6062receivers :
6163 # add the following config
@@ -65,34 +67,28 @@ receivers:
6567 endpoint : 0.0.0.0:11800
6668 http :
6769 endpoint : 0.0.0.0:12800
70+ ` ` `
71+
72+ 在 ` ` service.pipelines.traces` 一节中,增加如下内容:
73+ ` ` ` yaml
6874service:
6975 pipelines:
7076 traces:
7177 # add receiver ` skywalking`
7278 receivers : [skywalking]
7379` ` `
7480
75- 修改 otel-agent Service 配置:
76- ` ` ` bash
77- kubectl -n open-telemetry edit service otel-agent
78- ```
81+ 同时,确认 ` otel-agent-conf` 中参照[配置 otel-agent](../02-tracing/03-opentelemetry.md/#配置-otel-agent) 一节的内容完成了对应的配置。
7982
80- 增加以下配置:
81- ``` yaml
82- spec :
83- ports :
84- - name : sw-http
85- port : 12800
86- protocol : TCP
87- targetPort : 12800
88- - name : sw-grpc
89- port : 11800
90- protocol : TCP
91- targetPort : 11800
83+ 接着,使用如下命令修改 otel-agent Service,开放对应端口:
84+ ` ` ` bash
85+ kubectl -n open-telemetry patch service otel-agent -p '{"spec":{"ports":[{"name":"sw-http","port":12800,"protocol":"TCP","targetPort":12800},{"name":"sw-grpc","port":11800,"protocol":"TCP","targetPort":11800}]}}'
9286` ` `
9387
9488然后,检查应用中配置的 [SkyWalking OAP Server](https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-setup/#requirements-and-default-settings) 的对接地址,并修改为 Otel Agent 的 Service 地址:`otel-agent.open-telemetry`,比如将环境变量 `SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap-server:11800` 修改为 `SW_AGENT_COLLECTOR_BACKEND_SERVICES=otel-agent.open-telemetry:11800`。
9589
90+ 当然,应用配置的上报地址可能有各种形式,请根据应用实际启动命令修改,对于 `Java` 应用而言,只需要确保能修改启动命令中注入的地址即可,如:`-Dskywalking.collector.backend_service=otel-agent.open-telemetry:11800`。
91+
9692最后,重启 otel-agent 完成 otel-agent 更新:
9793` ` ` bash
9894kubectl rollout restart -n open-telemetry daemonset/otel-agent
@@ -110,7 +106,7 @@ kubectl rollout restart -n open-telemetry daemonset/otel-agent
110106
111107
112108
113- 使用如下命令可以一键部署这个 Demo:
109+ 使用如下命令可以一键部署这个 Demo,这个 Demo 已经完成了上报地址的配置,不需要再对它做额外修改。
114110` ` ` bash
115111kubectl apply -f https://raw.githubusercontent.com/deepflowio/deepflow-demo/main/DeepFlow-Otel-SkyWalking-Demo/deepflow-otel-skywalking-demo.yaml
116112` ` `
0 commit comments