Our next-gen architecture is built to help you make sense of your ever-growing data Watch a 4-min demo video!

Back to All Docs

OpenTelemetry Agent using Kubernetes OpenTelemetry Agent using Kubernetes

Last Updated: Nov. 28, 2022

OpenTelemetry is a vendor-neutral, open-source observability framework for instrumenting, generating, collecting, and exporting telemetry data such as traces, metrics, and logs. Use OpenTelemetry’s collection of APIs, SDKs, and tools to collect and export observability data from your environment to Coralogix.

This guide shows you how to run the v0.64.0 release of OpenTelemetry Collector in Kubernetes while deploying it in mode: daemonset to export your data to Coralogix. It assumes that you have already instrumented your application with OTel SDKs and set up a receiver for your data.

New! You can now enjoy Coralogix APM features when using OpenTelemetry collector with a Kubernetes processor.

Caution! Coralogix currently does not support OpenTelemetry Metrics Exporter Delta Temporality. Before configuring your SDK to use delta temporality, see the specification for the OTLP metric exporter.

Prerequisites

1. Sign up for a Coralogix account. Set up your account on the Coralogix domain corresponding to the region within which you would like your data stored.

2. Access your Coralogix private key.

3. Install Kubernetes. This should include installation of the command-line tool kubectl, designed to operate on your Kubernetes cluster.

4. Install and configure Helm. We suggest you use this guide to familiarize yourself with the basics of using Helm to manage packages on your Kubernetes cluster.

Setup

Installation

Coralogix has an exporter available for the OpenTelemetry Collector which allows you to forward trace and metric data from OpenTelemetry SDKs to Coralogix. The following section shows you how to easily install the exporter by adding it to your OpenTelemetry Collector configuration.

STEP 1: Install the Coralogix OpenTelemetry Agent Helm Chart Repository

Open a new terminal and install the Coralogix OpenTelemetry Agent helm chart repository:

helm repo add coralogix-charts-virtual https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
helm repo update

STEP 2: Create a Secret to Protect your Private Key

Create a secret with your Coralogix private key called coralogix-keys with the value PRIVATE_KEY.

Take this step in order to ensure that your private key remains protected and unexposed. While other methods exist for protecting this private information, we recommend creating a secret in this manner while running on a Kubernetes cluster.

Your private key, as well as the Helm chart, should be saved in the same namespace.

export PRIVATE_KEY=<private-key>
export NAMESPACE=<namespace>
kubectl create secret generic coralogix-keys -n $NAMESPACE --from-literal=PRIVATE_KEY=$PRIVATE_KEY

Hint: If you are interested in seeing the details of your secret called coralogix-keys, run:

kubectl get secret coralogix-keys -o yaml -n $NAMESPACE

The created secret should look like this, where PRIVATE_KEY is the value taken from your Coralogix private key. Compare the PRIVATE_KEY in your secret to the private key on your UI to ensure proper configuration.

apiVersion: v1
data:
  PRIVATE_KEY: <encrypted-private-key>
kind: Secret
metadata:
  name: coralogix-keys
  namespace: <namespace>
type: Opaque

Configuration

STEP 1: Create a YAML-Formatted Override File

Create a new YAML-formatted override file that defines certain values for the OpenTelemetry Collector.

In order to send your data to Coralogix, you are required to declare the endpoint variable into your file. You have the option of sending logs, metrics, and / or traces to Coralogix. The example override file below includes all three. For each, you will need to adjust the endpoint shown below to include the domain that correlates to your Coralogix account.

  • otel-logs.<domain>:443
  • otel-metrics.<domain>:443
  • otel-traces.<domain>:443
#values.yaml:
---
global:
  traces:
    endpoint: "<traces-endpoint-here>"
  metrics:
    endpoint: "<metrics-endpoint-here>"
  logs:
    endpoint: "<logs-endpoint-here>"

Save this file as values.yaml.

Here is information about other values for opentelemetry-collector. Making changes to these variables is optional.

  • mode: There are multiple ways to deploy the OpenTelemetry Collector in a Kubernetes infrastructure.
    • For high data traffic clusters, we recommend daemonset mode acting as an agent running on each node. Be aware that it consumes resources (e.g., CPU & memory) from each node on which it runs.
    • For development environments or clusters with minimal data, we recommend deployment mode.
  • extraEnvs: This includes your Coralogix private key.
  • presets: These are built-in variables that automatically add processor and integration attributes.
  • config: You have the option of sending logs, metrics, and / or tracing to Coralogix.
  • defaultApplicationName and defaultSubsystemName: Logs, metrics, and traces emitted by this OpenTelemetry exporter are tagged in Coralogix with the default application and subsystem constants “default” and “nodes”, respectively.

STEP 2: Install the Associated OpenTelemetry Chart

Install the associated OpenTelemetry chart with the release name of your choice.

export NAMESPACE=<namespace>
helm upgrade otel-coralogix-agent open-telemetry/opentelemetry-collector --install --namespace=$NAMESPACE --create-namespace -f <path/to/values.yaml>

Hint: Installing a new package requires two arguments: a release name that you pick and the name of the chart you want to install. You may choose any name that suits you; the example above adopts the release name otel-coralogix-agent.

Hint: The upgrade command will both install the OpenTelemetry Chart, then upgrade it to the latest commit of the values.yaml file above.

STEP 3: Ensure all Pods are Running

Ensure that all associated pods are running:

kubectl get pods -o wide -n $NAMESPACE |grep otel-coralogix-agent

The STATUS of these pods should appear “Running”. If this is not the case, see our Troubleshooting section below.

kubectl get pods -o wide -n $NAMESPACE |grep otel-coralogix-agent

Demo

In order to ensure that your data is being sent to Coralogix without being dependent on your own data, we recommend running a demo to validate your installation. We suggest doing so on non-production environments only.

1. In the same namespace in which the override file is saved, install the associated demo chart with the release name of your choice:

helm install my-otel-demo open-telemetry/opentelemetry-demo -f <path/to/coralogix-values.yaml>

2. Ensure all associated pods are running:

kubectl get pods -o wide |grep my-otel-dem

The STATUS of these pods should appear “Running”. If this is not the case, see our Troubleshooting section below.

3. Enable port forwarding so you can access the demo application from your browser:

kubectl port-forward svc/my-otel-demo-frontend 8080:8080

4. Open the following address in your browser:

http://localhost:8080

5. As you shop on the website, logs, metrics and/or traces will be sent to Coralogix, depending on which data you have chosen to send to us.

Troubleshooting

View data on your Coralogix dashboard

Once the installation process is complete, you may not see your telemetry data appear in your Coralogix account. This may indicate either that the installation has failed due to some error or that your installation is successful, but your application has not been configured to send data to Coralogix via this container.

In order to find the source of the problem, we recommend you take a number of steps, including troubleshooting your Otel logs and running a demo. If the demo works successfully, the problem lies in the configuration of your application. If the demo fails to work, the problem lies in the configuration of the collector. You will find tools to solve both of these issues below.

Troubleshoot your OTel logs

1. Following installation, expect Kubernetes to run a pod with your chosen installation name. Ensure this is the case by running the following command:

kubectl get pods -o wide -n $NAMESPACE |grep otel-coralogix-agent

2. Locate and copy the full name of the OpenTelemetry collector agent in your list of pods. The pod should appear exactly once with the STATUS “Running.” If the STATUS is “Pending”, rerun the command. The AGE appearing should be the time that has elapsed since your last helm upgrade.

3. Once you have located this specific pod, use the default logging tool command kubectl logs for retrieving its logs. Running this command with the -follow flag streams logs from the specified resource, allowing you to live tail its logs from your terminal.

kubectl logs --follow <paste full name of opentelemtry collector agent pod here> -n <namespace>

Here is an example of the expected output of Steps 1-3:

troubleshoot otel logs

Rerun this set of commands at any later stage as necessary.

Validate your endpoints

Validating your endpoints will allow you to test the connectivity in your domain structure.

Ensure that your endpoint is correct:

nslookup <endpoint name>

Here is an example of the expected results for an account in the EU1 region:

If you receive an error, this may mean that you lack connectivity to your domain server.

Additional Resources

Video: Integrate metrics into Coralogix using OpenTelemetry, Kubernetes & Helm

Video: Integrate traces into Coralogix using OpenTelemetry, Kubernetes & Helm

Video: Integrate logs into Coralogix using OpenTelemetry, Kubernetes & Helm

Video: Capture Kubernetes logs, transform with Logs2Metrics and render with DataMap

Github: Official OpenTelemetry Collector with Coralogix Exporter

Coralogix APM features when using OpenTelemetry collector with a Kubernetes processor

Support

Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email to [email protected].

On this page