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

Add gke PodMonitoring compatible labels for prometheus scrape-able services #1965

Conversation

ddelnano
Copy link
Member

@ddelnano ddelnano commented Jul 12, 2024

Summary: Add gke PodMonitoring compatible labels for prometheus scrape-able services

GKE's managed prometheus works by creating PodMonitoring resources that identify what targets to scrape. This resource only supports matching by labels and does not work with the existing annotations present in the Pixie cloud manifests. This PR adds PodMonitoring compatible labels that match the existing annotations

Relevant Issues: N/A

Type of change: /kind compatibility

Test Plan: Skaffold'ed to a cluster and verified the following:

  • Annotations and labels are set on the modified Deployments
  • GKE PodMonitoring resource correctly identifies backends now

…vices

Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano requested a review from a team as a code owner July 12, 2024 00:28
@@ -14,6 +14,9 @@ spec:
labels:
name: indexer-server
monitoring.gke.io/scrape: 'true'
prometheus.io/scrape: 'true'
prometheus.io/port: '51801'
prometheus.io/scheme: 'http'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use a yaml anchor to avoid duplicating these, but skaffold wasn't compatible with it:

@vihangm
Copy link
Member

vihangm commented Jul 12, 2024

The podMonitoring should only need labels to identify workloads to scrape. It then uses prometheus to scrape those targets which AFAIK still relies on the annotations.
If you use monitoring.gke.io/scrape: true as your labelSelector, I believe GKE PodMonitoring should work with the existing annotations for port discovery etc.

@ddelnano
Copy link
Member Author

ah, I see. I can confirm that using the monitoring.gke.io/scrape: true label selector with the existing annotation has the same effect.

@ddelnano ddelnano closed this Jul 12, 2024
@ddelnano ddelnano deleted the ddelnano/add-prometheus-labels-to-scraped-targets branch July 12, 2024 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants