|
3 | 3 | ## What is OtelCollector-Addon? |
4 | 4 |
|
5 | 5 | OtelCollector Addon is a pluggable addon working on the extensibility provided by [addon-framework](https://github.com/open-cluster-management-io/addon-framework) |
6 | | -which automates the installation of otelCollector on both hub cluster and managed clusters and jaeget-all-in-one on hub cluster for processing and storing the traces. |
| 6 | +which automates the installation of otelCollector on the managed clusters. |
7 | 7 |
|
8 | | -OtelCollecotr Addon consists of two components: |
9 | 8 |
|
10 | | -- __Addon-Manager__: Manages the installation of hub components for setting up the Addon |
| 9 | +### Prerequisite |
11 | 10 |
|
12 | | -- __Addon-Agent__: Manages the installation of collector agents in the managed clustres. |
| 11 | +The otel-addon depends on prometheus-stack installed on the hub cluster. Before you get started, you must have a OCM environment setuped. You can also follow our recommended [quick start guide](https://open-cluster-management.io/docs/getting-started/quick-start/) to set up a playgroud OCM environment. |
13 | 12 |
|
14 | | -The overall architecture is shown below: |
| 13 | +#### Add Helm Repo |
15 | 14 |
|
16 | | - |
| 15 | +```shell |
| 16 | +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 17 | +helm repo update |
| 18 | +``` |
| 19 | + |
| 20 | +#### Install Prometheus |
| 21 | + |
| 22 | +1. You need to create `monitoring` namespace in hub cluster with this command: |
| 23 | +``` |
| 24 | +kubectl --context kind-hub create namespace monitoring |
| 25 | +``` |
| 26 | + |
| 27 | +2. You have to run the script to generate the certs before installing prometheus with mTLS enabled. The script do the following things: |
| 28 | +- Generate root ca and key |
| 29 | +- Generate client ca and key |
| 30 | +- Generate server cert and key |
| 31 | +- Create prometheus-tls secret in monitoring namespace |
| 32 | +- Create otel-signer secret in open-cluster-management-hub namespace |
17 | 33 |
|
| 34 | +```shell |
| 35 | +cd hack/certs |
| 36 | +bash ./generate-certs.sh |
| 37 | +cd ../.. |
| 38 | +``` |
18 | 39 |
|
19 | | -### Installing via Helm Chart : |
| 40 | +3. Install Prometheus with the following command: |
20 | 41 |
|
21 | 42 | ```shell |
22 | | -$ helm install \ |
23 | | - -n open-cluster-management-addon --create-namespace \ |
24 | | - otel-collector charts/otel |
| 43 | +helm --kube-context kind-hub install prometheus prometheus-community/kube-prometheus-stack \ |
| 44 | + --namespace monitoring \ |
| 45 | + -f ./hack/prom/values.yaml |
25 | 46 | ``` |
26 | 47 |
|
27 | | -### Verifying the addOn : |
| 48 | +### Installing the otel-addon |
| 49 | + |
| 50 | +```shell |
| 51 | +kubectl --context kind-hub create namespace open-cluster-management-addon |
| 52 | +kubectl --context kind-hub apply -k deploy |
28 | 53 | ``` |
29 | | -$ kubectl -n open-cluster-management-addon get pod |
30 | | -NAME READY STATUS RESTARTS AGE |
31 | | -jaeger-all-in-one-57dcf4b5-ltt46 1/1 Running 0 65s |
32 | | -otel-collector-75fd748b4c-cbt7k 1/1 Running 0 65s |
33 | | -otel-collector-addon-manager-568885c78b-pl9db 1/1 Running 0 67s |
| 54 | + |
| 55 | +### Verifying the opentelemetry-collector in the managed clusters |
| 56 | +``` |
| 57 | +kubectl --context kind-cluster1 get pod -n open-cluster-management-agent-addon |
| 58 | +NAME READY STATUS RESTARTS AGE |
| 59 | +opentelemetry-collector-66fcdc8779-zvhff 1/1 Running 0 27s |
34 | 60 | ``` |
35 | 61 |
|
| 62 | +### Verify container advisor metrics |
| 63 | +``` |
| 64 | +curl -k https://hub-control-plane:30090/api/v1/query?query=container_fs_inodes_total | jq . |
| 65 | +{ |
| 66 | + "status": "success", |
| 67 | + "data": { |
| 68 | + "resultType": "vector", |
| 69 | + "result": [ |
| 70 | + { |
| 71 | + "metric": { |
| 72 | + "__name__": "container_fs_inodes_total", |
| 73 | + "beta_kubernetes_io_arch": "amd64", |
| 74 | + "beta_kubernetes_io_os": "linux", |
| 75 | + "cluster_name": "cluster1", |
| 76 | + "device": "overlay_0-157", |
| 77 | + "id": "/", |
| 78 | + "instance": "cluster1-control-plane", |
| 79 | + "job": "opentelemetry-collector", |
| 80 | + "kubernetes_io_arch": "amd64", |
| 81 | + "kubernetes_io_hostname": "cluster1-control-plane", |
| 82 | + "kubernetes_io_os": "linux" |
| 83 | + }, |
| 84 | + "value": [ |
| 85 | + 1751596235.174, |
| 86 | + "104840504" |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "metric": { |
| 91 | + "__name__": "container_fs_inodes_total", |
| 92 | + "beta_kubernetes_io_arch": "amd64", |
| 93 | + "beta_kubernetes_io_os": "linux", |
| 94 | + "cluster_name": "cluster2", |
| 95 | + "device": "overlay_0-313", |
| 96 | + "id": "/", |
| 97 | + "instance": "cluster2-control-plane", |
| 98 | + "job": "opentelemetry-collector", |
| 99 | + "kubernetes_io_arch": "amd64", |
| 100 | + "kubernetes_io_hostname": "cluster2-control-plane", |
| 101 | + "kubernetes_io_os": "linux" |
| 102 | + }, |
| 103 | + "value": [ |
| 104 | + 1751596235.174, |
| 105 | + "104840504" |
| 106 | + ] |
| 107 | + } |
| 108 | + ... |
| 109 | + ] |
| 110 | + } |
| 111 | +} |
| 112 | +``` |
0 commit comments