-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cluster API State Metrics implementation #6458
Comments
/milestone v1.2 |
Looks like the kube-state-metrics project made the implementation obsolete.
Source: https://kubernetes.slack.com/archives/CJJ529RUY/p1654257314683059 Looks like we should adapt, check if we could do the same with configuration only and deploying kube-state-metrics instead :-) |
Oh, interesting turn of events. Yeah let's figure out if that covers our use case. |
As i currently prepare our internal repositories to make use of kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: cluster.x-k8s.io
kind: Machine
version: v1beta1
metrics:
- each:
path:
- status
- phase
help: "machine phase"
name: phase As
Tried to circumvent the fact that a float is required with following config where i defined the path to the only numbered value field in the kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: cluster.x-k8s.io
kind: Machine
version: v1beta1
metrics:
- each:
valueFrom:
- metadata
- generation
path:
- status
- phase
help: "machine phase"
name: phase But still get an error:
It seems to me, that a well scoped metrics server for ClusterAPI (+ infrastructure implementations) still make sense. |
Just for my understanding, they only allow exposing floats directly as metrics? So something like the condition metrics just doesn't work? |
Exactly, exposing the condition as metric only might work, if at least one numbered field is in the spec (but my hack via If KSM-folks accept a patch for this and their plans are longer support for this experimental feature this could be a very promising solution for metrics. |
Yup that was my thinking. Essentially what is the gap and can we upstream enough to avoid maintaining our own state metrics |
I started a discussion in kube-state-metrics slack : https://kubernetes.slack.com/archives/CJJ529RUY/p1654593034854759 and we will move the discussion to an issue. For the CAPI project I think we have some options here to continue:
|
Assuming kube-state-metrics can cover all requirements and we'll migrate to it at some point, does it make sense to even migrate cluster-api-state-metrics into this repository? I think it would be fine to leave it where it is, and then just add the kube-state-metrics configuration to this repository (as well as tilt integration etc.). The time spent moving the code here is probably better invested into kube-state-metrics to get the custom metrics into a suitable replacement. |
In general I agree. Depending on how fast we can get the necessary features into kube-state-metrics we could also merge it and then use more and more from the upstream kube-state-metrics until cluster-api-state-metrics is not necessary anymore (as cluster-api-state-metrics imports/extends kube-state-metrics). But I think for now the best approach is to wait a bit with cluster-api-state-metrics to get a feeling for how fast we can make progress in extending kube-state-metrics (and thus how long it would take to get everything we need supported there). |
Some progress on the topic: I invested some time in kubernetes/kube-state-metrics#1755 which resulted in the PR kubernetes/kube-state-metrics#1777 to start some feedback. Running kube-state-metrics from the linked branch and using the config in kubernetes/kube-state-metrics#1777 (comment) would already cover nearly all metrics of the proposal, except the As of now I only see one small disadvantage for using the configuration style kube-state-metrics: we may have to split the All in all I still think going forward with upstream kube-state-metrics makes way more sense then implementing a custom binary. |
Sounds great!
I think that's fine and it's rather in the spirit of kube-state-metrics to straight forward expose the current state from resources without doing additional calculations. If desired this can always be done (at least in Prometheus) either in the alerts or in record rules. |
I will follow up the next days with a WIP PR which already integrates kube-state-metrics's helm chart into Tilt, similar to prometheus, grafana, ... Local version is already running and seems to integrate greatly 🎉 |
@chrischdi can we close this issue now and move pending items to separated issues? (I have already opened #7158) |
I've got two AI's I want to do and would have closed this issue afterwards:
Also the issue mentions the point |
I think finishing the two sub-tasks that you mentioned as part of this issue + a separate issue for release manifests would be good. I'm not sure if we want to release the manifests as long as we are writing / maintaining them manually. So this could depend on the gen tool. |
Fair point to get discussed in the follow-up issue then 👍 Ok, I will do so and also create the issue. |
xref: issue in kube-state-metrics for |
Closing here by marking the last step as done 🎉 / via creation of: /close |
@chrischdi: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Follow-up issue to track implementation of the merged proposal
as follow-up to
Current state is that the contribution PR needs to be done for https://github.com/mercedes-benz/cluster-api-state-metrics to the
exp/state-metrics
directory which is WIP at the branch https://github.com/mercedes-benz/cluster-api/tree/exp/casm-introduce .User Story
xref proposal user stories
TODOs:
Contribution: ✨ Contribute experimental cluster-api-state-metrics #6570not necessary, we can directly use kube-state-metrics and the new CustomResource configuration_labels
metricscluster_info
including.spec.controlPlaneEndpoint.host
as label metric to solve Raise a metric whenever CAPI cannot see a remote cluster client #5510clarify and implement steps for image publishingDetailed Description
[A clear and concise description of what you want to happen.]
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
/kind feature
The text was updated successfully, but these errors were encountered: