opentelemetry-helm-charts icon indicating copy to clipboard operation
opentelemetry-helm-charts copied to clipboard

components missing when executes through chart

Open roychshao opened this issue 1 year ago • 6 comments

hello, I am trying to use my own image on helm charts, and I was tell that there are some components invalidate. However, when I run the custom collector with almost same configuration file, it can noramlly detects these components. I wondering what is the reason for this situation, are there anything wrong in my configuration file or the helm chart?


first I built my custom collector with ocb version 0.95.0 and this is my builder-config.yaml

// builder-config.yaml

dist:
  name: custom-otelcol
  desciption: custom otelcol
  output_path: ./custom-otelcol

receivers:
  - gomod: "go.opentelemetry.io/collector/receiver/otlpreceiver v0.95.0"
    import: "go.opentelemetry.io/collector/receiver/otlpreceiver"
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver v0.95.0"
    import: "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver"
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8seventsreceiver v0.95.0"
    import: "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8seventsreceiver"

processors:
  - gomod: "go.opentelemetry.io/collector/processor/batchprocessor v0.95.0"
    import: "go.opentelemetry.io/collector/processor/batchprocessor"
  - gomod: "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.95.0"
    import: "go.opentelemetry.io/collector/processor/memorylimiterprocessor"

exporters:
  - gomod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.95.0"
    import: "go.opentelemetry.io/collector/exporter/otlpexporter"

extensions:
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage v0.95.0"
    import: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage"
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.95.0"
    import: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension"
  - gomod: "go.opentelemetry.io/collector/extension/ballastextension v0.95.0"
    import: "go.opentelemetry.io/collector/extension/ballastextension"

replaces:
  # a list of "replaces" directives that will be part of the resulting go.mod 
  - github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.95.0

I successfully built it with go 1.21.1 linux/amd64 and then I build a docker image contains the binary executable file

// dockerfile
FROM ubuntu:22.04
WORKDIR /app
COPY ./custom-otelcol/custom-otelcol /app

deploy it with opentelemetry helm chart below

NAME                                    CHART VERSION   APP VERSION     DESCRIPTION                                      
open-telemetry/opentelemetry-collector  0.82.0          0.95.0          OpenTelemetry Collector Helm chart for Kubernetes
open-telemetry/opentelemetry-demo       0.29.0          1.8.0           opentelemetry demo helm chart                    
open-telemetry/opentelemetry-ebpf       0.1.0           v0.10.0         OpenTelemetry eBPF Helm chart for Kubernetes     
open-telemetry/opentelemetry-operator   0.48.0          0.94.0          OpenTelemetry Operator Helm chart for Kubernetes

and execute helm install otel-deployment open-telemetry/opentelemetry-collector --values ./deployment.yaml with the deployment.yaml below

// deployment.yaml
mode: deployment

# We only want one of these collectors - any more and we'd produce duplicate data
replicaCount: 1

presets:
  # enables the k8sclusterreceiver and adds it to the metrics pipelines
  clusterMetrics:
    enabled: true
  # enables the k8sobjectsreceiver to collect events only and adds it to the logs pipelines
  kubernetesEvents:
    enabled: true

# service:
#   type: LoadBalancer
## The chart only includes the loggingexporter by default
## If you want to send your data somewhere you need to
## configure an exporter, such as the otlpexporter


image:
  repository: roychshao/custom-otelcol
  tag: latest
  pullPolicy: IfNotPresent

command:
  name: custom-otelcol
  extraArgs: []

config:
  receivers:
    otlp:
      protocols:
        grpc:
          endpoint: 0.0.0.0:4317
    jaeger: null
    prometheus: null
    zipkin: null
    k8scluster: {}

  exporters:
    logging: null
    debug: null
    prometheus: null
    otlp:
      endpoint: 192.168.43.182:4317 
      tls:
        insecure: true

  processors:
    batch: {}
    memory_limiter:
      check_interval: 1s
      limit_mib: 4000
      spike_limit_mib: 800

  extensions:
    file_storage:
      directory: /var/lib/otelcol/storage
      timeout: 1s
      compaction:
        on_start: true
        directory: /var/lib/otelcol/storage
        max_transaction_size: 65_535
      fsync: false
    memory_ballast: null
    health_check: {}

  service:
    extensions:
      - file_storage
      - memory_ballast
      - health_check
    pipelines:
      traces:
        receivers:
          - otlp
        processors:
          - batch
          - memory_limiter
        exporters:
          - otlp
      metrics:
        receivers:
          - otlp
          - k8scluster
        processors:
          - batch
          - memory_limiter
        exporters:
          - otlp
      logs:
        receivers:
          - otlp
          - k8sobjects
        processors:
          - batch
          - memory_limiter
        exporters:
          - otlp

I got this error message from my pod log

Error: failed to get config: cannot unmarshal the configuration: 4 error(s) decoding:
* error decoding 'exporters': unknown type: "prometheus" for id: "prometheus" (valid values: [otlp])
* error decoding 'extensions': unknown type: "health_check" for id: "health_check" (valid values: [file_storage])
* error decoding 'processors': unknown type: "memory_limiter" for id: "memory_limiter" (valid values: [batch])
* error decoding 'receivers': unknown type: "k8s_cluster" for id: "k8s_cluster" (valid values: [otlp])
2024/02/28 13:40:30 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 4 error(s) decoding:
* error decoding 'exporters': unknown type: "prometheus" for id: "prometheus" (valid values: [otlp])
* error decoding 'extensions': unknown type: "health_check" for id: "health_check" (valid values: [file_storage])
* error decoding 'processors': unknown type: "memory_limiter" for id: "memory_limiter" (valid values: [batch])
* error decoding 'receivers': unknown type: "k8s_cluster" for id: "k8s_cluster" (valid values: [otlp])

It seems like it tells me that these components not exists in the collector, but when I run this custom collector on my local and with the same configuration, I didn't get these error messages.

// config.yaml
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

exporters:
  otlp:
    endpoint: localhost:6000
    tls:
      insecure: true

processors:
  batch:
  memory_limiter:
    check_interval: 1s
    limit_mib: 4000
    spike_limit_mib: 800

extensions:
  file_storage:
    directory: /var/lib/otelcol/custom-otelcol
    timeout: 1s
    compaction:
      on_start: true
      directory: /tmp/
      max_transaction_size: 65_536
    fsync: false
  health_check:
  memory_ballast:

service:
  extensions: [file_storage, health_check, memory_ballast]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch, memory_limiter]
      exporters: [otlp]
    metrics:
      receivers: [otlp]
      processors: [batch, memory_limiter]
      exporters: [otlp]
    logs:
      receivers: [otlp]
      processors: [batch, memory_limiter]
      exporters: [otlp]

Can anyone tell me the why this could happen and how to solve it ? By the way, you can pull my docker image for reproducing this. (I know k8scluster receiver does not be configured on config.yaml, but I guess the error reason for the four components are the same?)

roychshao avatar Feb 28 '24 14:02 roychshao

Did you find a fix for this? I'm planning on using my own connector too and my setup is kinda similar to yours so far.

TheJarX avatar Aug 20 '24 16:08 TheJarX

@TheJarX are you also experiencing an error? The original issue is definitely happening bc the image being used does not contain the components it should. This was likely caused by an issue building the image or making it available on the cluster, not with the collector or helm chart.

TylerHelmuth avatar Aug 20 '24 16:08 TylerHelmuth

@TylerHelmuth Thanks for your response. In fact, I have confirmed the image by executing the shell and check the binary file exist and also run the binary file outside the container. It can run successfully with the components running at that time. Do you have any thoughts about how could it be if the image and collector issue are excluded?

roychshao avatar Aug 20 '24 17:08 roychshao

@TheJarX No, I manually build and deploy the collector container rather than use the helm chart before.

roychshao avatar Aug 20 '24 17:08 roychshao

@roychshao you can try with a latest OCB and collector components, but I have been unable to reproduce your issue. The error message indicates that the first component in each of your sections in the builder-config.yaml is being used. This implies either the builder-config.yaml you're using to build the image that is getting used is not the one posted in the issue, or the image that ends up getting used is not the one it is supposed to be.

TylerHelmuth avatar Aug 20 '24 17:08 TylerHelmuth

@TylerHelmuth Oh I got what you mean, indeed this indicates that it is using a config file that isn't match. I would do it again to verify it, thanks.

roychshao avatar Aug 20 '24 17:08 roychshao