Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes ingresses not being observed by extension #35324

Closed
stokerjon opened this issue Sep 20, 2024 · 5 comments · Fixed by #35539
Closed

kubernetes ingresses not being observed by extension #35324

stokerjon opened this issue Sep 20, 2024 · 5 comments · Fixed by #35539

Comments

@stokerjon
Copy link

Component(s)

extension/observer/k8sobserver

What happened?

Description

When using k8s_observer with receiver creator and setting observe_ingresses: true it would be expected that it would start to create recievers based off of ingresses available in the cluster.

having a quick look it looks like the code to enable observing ingresess is missing from extension/observer/k8sobserver/extension.go

Steps to Reproduce

create a colloctor with the provided config

Expected Result

receiver creator would create receivers for ingresses in the cluster

Actual Result

ingresses are not observed and receiver creator does nothing

Collector version

v1.15.0/v0.109.0

Environment information

Environment

OS: amazon linux
kubernetes: v1.30

OpenTelemetry Collector configuration

config:
    extensions:
      k8s_observer:
        auth_type: serviceAccount
        observe_pods: false
        observe_ingresses: true
    exporters:
      debug:
        verbosity: normal
        sampling_initial: 1
        sampling_thereafter: 1
    processors:
    receivers:
      receiver_creator:
        watch_observers:
          - k8s_observer
        receivers:
          httpcheck:
            rule: type == "k8s.ingress"
            config:
              config:
                targets:
                  - endpoint: "https://`host`/`path`"
                    method: GET
                collection_interval: 10s
    service:
      telemetry:
        logs:
          level: "DEBUG"
          development: true
          encoding: "json"
      extensions:
        - k8s_observer
      pipelines:
        metrics:
          exporters:
            - debug
          processors: []
          receivers:
            - receiver_creator

Log output

{"level":"info","ts":1726843193.1351163,"caller":"[email protected]/service.go:129","msg":"Setting up own telemetry..."}
{"level":"warn","ts":1726843193.1352572,"caller":"[email protected]/service.go:196","msg":"service::telemetry::metrics::address is being deprecated in favor of service::telemetry::metrics::readers","stacktrace":"go.opentelemetry.io/collector/service.logsAboutMeterProvider\n\tgo.opentelemetry.io/collector/[email protected]/service.go:196\ngo.opentelemetry.io/collector/service.New\n\tgo.opentelemetry.io/collector/[email protected]/service.go:143\ngo.opentelemetry.io/collector/otelcol.(*Collector).setupConfigurationComponents\n\tgo.opentelemetry.io/collector/[email protected]/collector.go:183\ngo.opentelemetry.io/collector/otelcol.(*Collector).Run\n\tgo.opentelemetry.io/collector/[email protected]/collector.go:282\ngo.opentelemetry.io/collector/otelcol.NewCommand.func1\n\tgo.opentelemetry.io/collector/[email protected]/command.go:36\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/[email protected]/command.go:985\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/[email protected]/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/[email protected]/command.go:1041\nmain.runInteractive\n\tgithub.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:49\nmain.run\n\tgithub.com/open-telemetry/opentelemetry-collector-releases/contrib/main_others.go:10\nmain.main\n\tgithub.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:42\nruntime.main\n\truntime/proc.go:272"}
{"level":"info","ts":1726843193.135332,"caller":"[email protected]/telemetry.go:98","msg":"Serving metrics","address":":8888","metrics level":"Normal"}
{"level":"info","ts":1726843193.1354373,"caller":"builders/builders.go:26","msg":"Development component. May change in the future.","kind":"exporter","data_type":"metrics","name":"debug"}
{"level":"debug","ts":1726843193.1357343,"caller":"builders/builders.go:24","msg":"Beta component. May change in the future.","kind":"receiver","name":"receiver_creator","data_type":"metrics"}
{"level":"debug","ts":1726843193.1357844,"caller":"builders/extension.go:48","msg":"Alpha component. May change in the future.","kind":"extension","name":"k8s_observer"}
{"level":"info","ts":1726843193.1560295,"caller":"[email protected]/service.go:213","msg":"Starting otelcol-contrib...","Version":"0.109.0","NumCPU":8}
{"level":"info","ts":1726843193.156081,"caller":"extensions/extensions.go:39","msg":"Starting extensions..."}
{"level":"info","ts":1726843193.1561005,"caller":"extensions/extensions.go:42","msg":"Extension is starting...","kind":"extension","name":"k8s_observer"}
{"level":"info","ts":1726843193.1561198,"caller":"extensions/extensions.go:59","msg":"Extension started.","kind":"extension","name":"k8s_observer"}
{"level":"info","ts":1726843193.1562421,"caller":"[email protected]/service.go:239","msg":"Everything is ready. Begin running and processing data."}

Additional context

No response

@stokerjon stokerjon added bug Something isn't working needs triage New item requiring triage labels Sep 20, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@bacherfl
Copy link
Contributor

bacherfl commented Oct 1, 2024

Hi @stokerjon I also just looked into this and seems you are right - the config for enabling the Ingress observation does not seem to be considered when creating the K8s resource informers - right now, only pods, nodes and services are observed. I'd be happy to work on a PR to fix that

@atoulme atoulme removed the needs triage New item requiring triage label Oct 12, 2024
dmitryax pushed a commit that referenced this issue Nov 3, 2024
**Description:** This PR fixes the observation of ingress objects by the
k8sobserver. The issue was that the `observe_ingresses` option was not
considered in the extension setup, and no informer for the ingress
resource type has been created

**Link to tracking Issue:** #35324 

**Testing:** Added unit tests. Also did manual testing against a k8s
cluster to check whether ingress objects are picked up as expected

**Documentation:** No change there, as the `observe_ingresses` option
was already documented in the readme

---------

Signed-off-by: Florian Bacher <[email protected]>
Co-authored-by: Moritz Wiesinger <[email protected]>
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Dec 12, 2024
@ChrsMark ChrsMark linked a pull request Dec 12, 2024 that will close this issue
@stokerjon
Copy link
Author

This is fixed now, thanks

@ChrsMark
Copy link
Member

Thank's @bacherfl for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants