Skip to content

GoogleCloudPlatform/otlp-k8s-ingest

Repository files navigation

OTLP Kubernetes Ingest

This project contains Kubernetes manifests for self-deployed OTLP ingest on Kubernetes.

Running on GKE

Before we begin, set required environment variables:

export GCLOUD_PROJECT=<your project id>
export PROJECT_NUMBER=<your project number>

Configure IAM Permissions

You can skip this step if you have disabled GKE workload identity in your cluster.

Follow the Workload Identity docs to allow the collector's kubernetes service account to write logs, traces, and metrics:

gcloud projects add-iam-policy-binding projects/$GCLOUD_PROJECT \
    --role=roles/logging.logWriter \
    --member=principal://iam.googleapis.com/projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$GCLOUD_PROJECT.svc.id.goog/subject/ns/opentelemetry/sa/opentelemetry-collector
gcloud projects add-iam-policy-binding projects/$GCLOUD_PROJECT \
    --role=roles/monitoring.metricWriter \
    --member=principal://iam.googleapis.com/projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$GCLOUD_PROJECT.svc.id.goog/subject/ns/opentelemetry/sa/opentelemetry-collector
gcloud projects add-iam-policy-binding projects/$GCLOUD_PROJECT \
    --role=roles/cloudtrace.agent \
    --member=principal://iam.googleapis.com/projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$GCLOUD_PROJECT.svc.id.goog/subject/ns/opentelemetry/sa/opentelemetry-collector

Install the manifests

First, make sure you have followed the Workload Identity setup steps above.

Then, apply the Kubernetes manifests directly from this repo:

kubectl kustomize https://github.com/GoogleCloudPlatform/otlp-k8s-ingest/k8s/base | envsubst | kubectl apply -f -

(Remember to set the GCLOUD_PROJECT environment variable.)

[Optional] Run the OpenTelemetry demo application alongside the collector

To test out and see the deployment in action, you can run the demo OpenTemetry application using

kubectl apply  -f sample/.

See Telemetry in Google Cloud Observability

Metrics, Log and Traces should be now available in your project in Cloud Observability. You can see metrics under "Prometheus Target" in Cloud Monitoring.

Observability of the OpenTelemetry Collector

In order to monitor the OpenTelemetry collector, you can deploy the dashboards available here.

You can import these dashboards by navigating to the Google Cloud Console and:

  • Navigating to Monitoring > Dashboards
  • Clicking on the Sample Library tab to find all available samples
  • Clicking on the OpenTelemetry Collector category from the list
  • Select and import the available dashboards

Once you import and apply the dashboard, you'll see several metrics tracking the uptime of the collector, its memory footprint and the API calls it makes to Cloud Observability:

OpenTelemetry Collector Dashboard

Contributing

See CONTRIBUTING.md for details.

License

Apache 2.0; see LICENSE for details.

Disclaimer

This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.