Search…
Deploying a Collector
There are two primary methods for deploying the OpenTelemetry Collector on Kubernetes:
  1. 1.
    Agent: one Collector instance per Node running as a Kubernetes DaemonSet, plus one Collector instance acting as an egress gateway. In this configuration, the Vamp Release Agents connect to the local agent.
  2. 2.
    Standalone Gateway: one Collector instance per cluster acting as an egress gateway. In this configuration, the Vamp Release Agents connect directly to the gateway Collector.
The following command will install an example agent DaemonSet and and a single gateway instance:
1
kubectl apply -f https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/examples/k8s/otel-config.yaml
Copied!
This example uses the latest development version of the Collector and is not intended for production usage.

Configuring the Collector

If you are using the example Collector, you need to add a metrics exporter and a metrics pipeline.
Running the following command opens the otel-collector-conf ConfigMap in an editor:
1
kubectl edit cm otel-collector-conf
Copied!
Now add the following lines to the exporters section:
1
logging:
2
loglevel: debug
Copied!
And add these lines to the pipelines section:
1
metrics:
2
receivers: [otlp]
3
processors: [memory_limiter, batch]
4
exporters: [logging]
Copied!
When you have finished, the config should look similar to this example:
Example otel-collector-conf
The otel-collector Pod will not automatically apply the new config when the ConfigMap is updated. You need to manually delete the Pod for the new config to take effect.
Running this command deletes the running otel-collector Pod:
1
kubectl delete pod -l app=opentelemetry,component=otel-collector
Copied!

Configuring the Collector Agents

If you are going to connect Vamp Release Agents to the to the local Collector agent, you need to make a couple of changes to the example Collector.
Running the following command will open the otel-agent-conf ConfigMap in an editor:
1
kubectl edit cm otel-agent-conf
Copied!
Now add the following lines to the pipelines section:
1
metrics:
2
receivers: [otlp]
3
processors: [memory_limiter, batch]
4
exporters: [otlp]
Copied!
When you have finished, the config should look similar to this example:
Example otel-agent-conf
The example otel-agent DaemonSet doesn't have host networking enabled by default
Finally, you need to enable host networking for the otel-agent DaemonSet. This makes the OTLP endpoint available on port 55680 for every Pod in the cluster.
Host networking can be enabled by running this command:
1
kubectl patch daemonset otel-agent -p '"spec": {"template": {"spec": {"hostNetwork": true, "dnsPolicy": "ClusterFirstWithHostNet"}}}'
Copied!
This will also cause all the Pods in the DaemonSet to be replaced, which also allows the config change to take effect.