how to bring metrics client to use k8s metrics APIs #2229
-
I'd like to bring metrics client into my project, so I can query against k8s custom metrics API. Do we have demo or doc about that? It seems the default |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @huanggze, The projects built with the tool are using controller runtime and some metrics are provided by default. See its documentation: https://book.kubebuilder.io/reference/metrics.html The metrics are exported from the Manager, see: kubebuilder/testdata/project-v3/main.go Lines 70 to 71 in 26d12ab However, if for someone reason you are looking to check how via code implementation you can access the metrics endpoint and check it out you can see how we do it in our e2e tests, see:
Following are the metrics returned:
|
Beta Was this translation helpful? Give feedback.
-
Closing since it is answered. |
Beta Was this translation helpful? Give feedback.
Hi @huanggze,
The projects built with the tool are using controller runtime and some metrics are provided by default. See its documentation: https://book.kubebuilder.io/reference/metrics.html
The metrics are exported from the Manager, see:
kubebuilder/testdata/project-v3/main.go
Lines 70 to 71 in 26d12ab
However, if for someone reason you are looking to check how via code implementation you can access the metrics endpoint and check it out you can see how we do it in our e2e tests, see:
See here we granting the permissions:
kubebuilder/test/e2e/v3/plugin_cluster_test.go
Lines 257 to 265 in 26d12ab