Skip to content

Latest commit

 

History

History
99 lines (69 loc) · 3.55 KB

README_GCP.md

File metadata and controls

99 lines (69 loc) · 3.55 KB

Running the demo on Google Cloud

The demo can send logs, traces, and metrics to Google Cloud. The easiest way to do this is with the gcp/helmfile.yaml (when deploying via Helmfile on GKE) or src/otelcollector/otelcol-config-extras.yml when running with docker-compose on GCE.

Running on GKE

The recommended way to run the demo on GKE is with the official Helm chart. If running on a GKE Autopilot cluster (or any cluster with Workload Identity), you must follow the prerequisite steps to set up a Workload Identity-enabled service account below. Otherwise, you can skip to the next section.

Workload Identity prequisites

Grant permission using Workload Identity to write logs, traces, and metrics:

export GCLOUD_PROJECT=<your project id>
export PROJECT_NUMBER=$(gcloud projects describe ${GCLOUD_PROJECT} --format='get(projectNumber)')
gcloud projects add-iam-policy-binding ${GCLOUD_PROJECT} \
    --member "principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/otel-demo/sa/opentelemetry-demo-otelcol" \
    --role "roles/logging.logWriter"
gcloud projects add-iam-policy-binding ${GCLOUD_PROJECT} \
    --member "principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/otel-demo/sa/opentelemetry-demo-otelcol" \
    --role "roles/monitoring.metricWriter"
gcloud projects add-iam-policy-binding ${GCLOUD_PROJECT} \
    --member "principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/otel-demo/sa/opentelemetry-demo-otelcol" \
    --role "roles/cloudtrace.agent"
gcloud iam service-accounts add-iam-policy-binding opentelemetry-demo@${GCLOUD_PROJECT}.iam.gserviceaccount.com \
    --member "principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/otel-demo/sa/opentelemetry-demo-otelcol" \
    --role roles/iam.workloadIdentityUser \

Deploying the Helmfile

Make sure you have the following installed:

Ensure you have either configured or disabled Workload Identity in your cluster.

helmfile --interactive apply -f gcp/helmfile.yaml

Cleaning up the helmfile

To clean up, run:

helmfile --interactive destroy -f gcp/helmfile.yaml

(Alternative) Using kubectl apply

Installing with the Helm chart is recommended, but you can also use kubectl apply to install the manifests directly.

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

Install the manifests:

kubectl apply -n otel-demo -f ./kubernetes/opentelemetry-demo.yaml

Running on GCE

Follow the OpenTelemetry docs to run with Docker:

make start

Seeing telemetry

With the demo running, you should see telemetry automatically created by the demo's load generator. You can see metrics under "Prometheus Target" in Cloud Monitoring:

metrics

Traces in the Trace explorer:

traces

And logs in the Logs explorer organized by service:

logs