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

Prometheus PodMonitor for Knative is incorrectly generated #6014

Open
Evynglais opened this issue Jan 3, 2025 · 3 comments
Open

Prometheus PodMonitor for Knative is incorrectly generated #6014

Evynglais opened this issue Jan 3, 2025 · 3 comments
Labels
kind/bug Something isn't working

Comments

@Evynglais
Copy link

What happened?

Using the Prometheus trait with a Knative Camel-K integration results in an invalid PodMonitor configuration (a port that doesn't exist).

Steps to reproduce

  1. Deploy a Camel-K integration as a Knative service, with --trait prometheus.enabled=true.
kamel run "${SCRIPT_DIR}"/pre.ingress.camel.yaml --name pre-ingress \
    --trait knative-service.min-scale=1 \
    --trait prometheus.enabled=true \
    --property quarkus.kubernetes-config.enabled=true \
    --property quarkus.kubernetes-config.config-maps=pre.ingress.ibm.config
  1. Observe the target group on Prometheus; it will be empty.
    image
  2. Observe the podmonitor created by Camel-K; it will reference port 'h2c' which doesn't exist.
    image

Actual ports:
image
image

Relevant log output

No response

Camel K version

2.5.0

@Evynglais Evynglais added the kind/bug Something isn't working label Jan 3, 2025
@squakez
Copy link
Contributor

squakez commented Jan 3, 2025

That is something expected according to Knative spec: https://github.com/knative/specs/blob/main/specs/serving/runtime-contract.md#protocols-and-ports - you may need to verify on the KnativeService custom resource if that is configured correctly. Alternatively you may need to specify the port name on the container trait. @hernanDatgDev @mertdotcc I think you folks are using Knative + Prometheus, would you mind to confirm if that is the expected behavior?

@Evynglais
Copy link
Author

The way that camel is working as a Knative Service is expected and working fine; the PodMonitor looks to me that it is generated incorrectly.

@squakez
Copy link
Contributor

squakez commented Jan 7, 2025

I see this is a possible regression introduced by #1555. The "problem" is that the KnativeService resource is setting the port as

 - containerPort: 8080
   name: h2c
   protocol: TCP

However the Deployment (hence, the Pod) is set as:

- containerPort: 8080
  name: user-port
  protocol: TCP

As a most immediate workaround you can try to put a name on the port using Container portName trait configuration. Can you verify if that one temporarily solves the problems?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants