equinix-labs / otel-cli

OpenTelemetry command-line tool for sending events from shell scripts & similar environments
Apache License 2.0
512 stars 55 forks source link

Add TLS certificates to Docker image #293

Closed smithclay closed 8 months ago

smithclay commented 1 year ago

Hello, the docker image published to ghcr.io/equinix-labs/otel-cli:latest is very helpful in running otel-cli in containerized/k8s environments. However, it has issues sending data to any TLS endpoints as certificates are not included the image. All TLS requests fail with the following:

2023/11/09 16:57:00 rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: failed to verify certificate: x509: certificate signed by unknown authority"

Would it be possible to update the Dockerfile to use a base image with certificates installed?

Example of running the image in k8s where certificates are needed:

kubectl run otel-cli \
    --image=ghcr.io/equinix-labs/otel-cli:latest \
     --env "OTEL_EXPORTER_OTLP_ENDPOINT=ingest.lightstep.com:443" \
     --env 'OTEL_EXPORTER_OTLP_HEADERS="lightstep-access-token=..."' \
     --command -- ./otel-cli span --verbose -n testing -s k8s_span

Currently have a fork of the image being built here: https://github.com/lightstep/otel-cli-with-certs

tobert commented 1 year ago

I was just thinking about this the other day. My thought was to add instructions for using volumes to get the system SSL certs into the container, but I suppose making things easy on users is best done by including the cert package. Will do in the next release.

tobert commented 1 year ago

PR'ed #295 please review if you have a moment. I'll cut a release soon so you can simplify your workflow.

tobert commented 8 months ago

I guess I didn't fully release 0.4.2. 0.4.3 is out and includes these changes. Thanks for the issue!