-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cannot create informers to capture the pod metrics #3639
Comments
@vegoutha it looks like the metadata for pod and node metrics is not correct as it's just using the default plural. The workaround would be to use generic logic: client.genericKubernetesResources(new ResourceDefintionContext.Builder().withGroup("metrics.k8s.io").withVersion("v1beta1").withPlural("pods").withNamespaced(true).build()).inform You can convert between a GenericKubernetesResource and PodMetrics by using Serialization.jsonMapper().convertValue(genericResource, PodMetrics.class) or just use the generic. |
Does this actually work? Metrics HTTP API is not standard, I wasn't sure that this could actually work. |
It should, or at least it will hit the endpoint he is wanting to. There reason that informers don't work here is that they are pulling the plural from the class. Regular node/pod metric operations are working because the plural is being passed via the *OperationImpl. |
Thanks @shawkins . Workaround provided in the above comment #3639 (comment) works for me. |
Also related to this is that NodeMetrics is currently marked as Namespaced, and it should not be. |
Tried to create informer with resource object
PodMetrics
and observed the below error:Code Snippet:
Error message:
Listed the api-resources with APIVERSION "metrics.k8s.io/v1beta1":
GET URL is supposed to be
https://localhost:5125/apis/metrics.k8s.io/v1beta1/namespaces/default/pods
@rohanKanojia Please let me know how to capture the pod metrics using informers.
The text was updated successfully, but these errors were encountered: