open-telemetry / opentelemetry-operator

Kubernetes Operator for OpenTelemetry Collector
Apache License 2.0
1.18k stars 418 forks source link

Ingress created to expose the collector is not correct for the HTTP receiver #2449

Open iblancasa opened 9 months ago

iblancasa commented 9 months ago

Component(s)

operator

What happened?

The Ingress object created to expose the Collector outside the cluster is not created properly for the HTTP receiver.

Environment:

When I create this OpenTelemetry Collector instance:

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: simplest
spec:
  mode: "deployment"
  ingress:
    type: ingress
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    exporters:
      debug:

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: []
          exporters: [debug]

This is the created Ingress instance:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  creationTimestamp: "2023-12-18T11:04:39Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: demo.simplest
    app.kubernetes.io/managed-by: opentelemetry-operator
    app.kubernetes.io/name: simplest-ingress
  name: simplest-ingress
  namespace: demo
  ownerReferences:
  - apiVersion: opentelemetry.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: OpenTelemetryCollector
    name: simplest
    uid: 540cf5f8-29ec-4d8e-94b5-cf89749e8c9e
  resourceVersion: "1038"
  uid: 6d2f105f-8d56-4967-86db-e8c62f291cd3
spec:
  rules:
  - http:
      paths:
      - backend:
          service:
            name: simplest-collector
            port:
              name: otlp-grpc
        path: /otlp-grpc
        pathType: Prefix
      - backend:
          service:
            name: simplest-collector
            port:
              name: otlp-http
        path: /otlp-http
        pathType: Prefix
status:
  loadBalancer: {}

If I run curl to the exposed URL:

$ curl http://localhost/otlp-http/v1/traces
404 page not found

If I try to send traces from a Python application, I can see this error message:

Failed to export batch code: 404, reason: 404 page not found

If I do port forwarding to the 4318 port, and run curl for the same subpath:

$ curl http://localhost:4318/v1/traces
405 method not allowed, supported: [POST]

Kubernetes Version

1.24

Operator version

c8b2970

Collector version

0.90.0

Environment information

No response

Log output

No response

Additional context

No response

Starefossen commented 7 months ago

Facing the same issue. Ingress does not work at the moment.

CCOLLOT commented 3 weeks ago

I bumped into the same issue and had to switch to a self-managed ingress resource.