Skip to content

[PLAT-520] Added kube-state-metrics support#126

Open
baba230896 wants to merge 5 commits intoyugabyte:masterfrom
baba230896:plat-520
Open

[PLAT-520] Added kube-state-metrics support#126
baba230896 wants to merge 5 commits intoyugabyte:masterfrom
baba230896:plat-520

Conversation

@baba230896
Copy link
Contributor

@baba230896 baba230896 commented Mar 16, 2022

Summary

  • Users can provide the custom endpoint for kube-state-metrics.
  • Users can install the kube-state-metrics and the platform in the same namespace with a single flag modification.

Testing

I have done the following testing -

  1. Custom kube-state-metrics endpoint.
  2. kube-state-metrics installation.
  3. Platform chart will use the custom endpoint if the user provides both the installation flag and custom endpoint. I have provided a higher priority to the custom endpoint than the installation.
  4. Default platform chart installation works as intended.

For second commit which has changes related to prometheus scrape configuration.

Summary

  • The kube-state-metric changed the following CPU metric name. And the Yugabyte Platform java code still uses the old metric name to show the CPU metric on Platform UI. At this place, we had two ways to solve this. Either update the java code or handle it in the Prometheus scrape configuration. We have chosen the second approach and fixed the Prometheus scrape configuration.

  • I have updated the Platform code to use the new CPU metric (kube_pod_container_resource_requests) and added the relabel in Prometheus to convert the old CPU metric (kube_pod_container_resource_requests_cpu_cores) to new.

Test

  • Deployed the platform using without this change and created the universe. We didn't have CPU metrics in the Platform UI at this time. Once I modified the Prometheus config using the helm upgrade, it started showing the CPU metrics.

image
image

Summary

- Users can provide the custom endpoint for kube-state-metrics.
- Users can install the kube-state-metrics and the platform in the same namespace with a single flag modification.

Testing

I have done the following testing -

- Custom kube-state-metrics endpoint.
- kube-state-metrics installation.
- Platform chart will use the custom endpoint if the user provides both installation flag and custom endpoint.
  I have provided a higher priority to the custom endpoint than the installation.
- Default platform chart installation works as intended.
Summary -

The kube-state-metric changed the following CPU metric name.
And the Yugabyte Platform java code still uses the old metric name to show the CPU metric on Platform UI.
At this place, we had two ways to solve this. Either update the java code or handle it in the Prometheus scrape configuration.
We have chosen the second approach and fixed the Prometheus scrape configuration.

Test -
Deployed the platform using without this change and created the universe.
We didn't have CPU metrics in the Platform UI at this time.
Once I modified the Prometheus config using the helm upgrade, it started showing the CPU metrics.
@baba230896 baba230896 requested a review from anmalysh-yb March 31, 2022 06:37
Copy link
Contributor

@anmalysh-yb anmalysh-yb left a comment

Choose a reason for hiding this comment

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

LGTM.
One question.

@baba230896
Copy link
Contributor Author

@anmalysh-yb I have modified the changes as per the suggestion. Could you please review the latest change and this related PR?

@baba230896
Copy link
Contributor Author

@anmalysh-yb Please check it once.

Copy link
Contributor

@anmalysh-yb anmalysh-yb left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@bhavin192 bhavin192 left a comment

Choose a reason for hiding this comment

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

Overall this looks good, I have suggested few changes.

baba230896 and others added 2 commits May 6, 2022 13:12
1. kubeStateMetric to kubeStateMetrics
2. Added a few explanatory comments

Co-authored-by: Bhavin Gandhi <bhavin192@users.noreply.github.com>
@monotek
Copy link
Contributor

monotek commented Apr 21, 2025

This could be likely done via chart dependency to the official kube-state-metrics helm chart: https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics

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.

4 participants