-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add KSM CR metrics #32716
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 KSM CR metrics #32716
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,7 +411,110 @@ | |
|
|
||
| <div class="alert alert-info">You can select up to 50 fields per resource. You can use the preview to validate your indexing choices.</div> | ||
|
|
||
| ### Collect custom resource metrics using Kubernetes State Core check | ||
|
|
||
| <div class="alert alert-info">This functionality requires Cluster Agent 7.63.0+.</div> | ||
|
|
||
| You can use the `kubernetes_state_core` check to collect custom resource metrics when running the Datadog Cluster Agent. | ||
|
|
||
| 1. Write defintions for your custom resources and the fields to turn into metrics according to the following format: | ||
|
|
||
| ```yaml | ||
| #=(...) | ||
| collectCrMetrics: | ||
| - groupVersionKind: | ||
| group: "crd.k8s.amazonaws.com" | ||
| kind: "ENIConfig" | ||
| version: "v1alpha1" | ||
| commonLabels: | ||
| crd_type: "eniconfig" | ||
| labelsFromPath: | ||
| crd_name: [metadata, name] | ||
| metrics: | ||
| - name: "eniconfig" | ||
| help: "ENI Config" | ||
| each: | ||
| type: gauge | ||
| gauge: | ||
| path: [metadata, generation] | ||
| - groupVersionKind: | ||
| group: "vpcresources.k8s.aws" | ||
| kind: "CNINode" | ||
| version: "v1alpha1" | ||
| resource: "cninode-pluralized" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What this field is / why it is needed / when it is needed could be explicitly called out somewhere here |
||
| commonLabels: | ||
| crd_type: "cninode" | ||
| labelsFromPath: | ||
| crd_name: [metadata, name] | ||
| metrics: | ||
| - name: "cninode" | ||
| help: "CNI Node" | ||
| each: | ||
| type: gauge | ||
| gauge: | ||
| path: [metadata, generation] | ||
| ``` | ||
|
|
||
| For more details, see [Custom Resource State Metrics][5]. | ||
|
|
||
| 2. Update your Helm or Datadog Operator configuration: | ||
|
|
||
| {{< tabs >}} | ||
| {{% tab "Helm Chart" %}} | ||
|
|
||
| 1. Add the following configuration to `datadog-values.yaml`: | ||
|
|
||
| ```yaml | ||
| datadog: | ||
| #(...) | ||
| kubeStateMetricsCore: | ||
| collectCrMetrics: | ||
| - <CUSTOM_RESOURCE_METRIC> | ||
| ``` | ||
|
|
||
| Replace `<CUSTOM_RESOURCE_METRIC>` with the definitions you wrote in the first step. | ||
|
|
||
| 1. Upgrade your Helm chart: | ||
|
|
||
| ``` | ||
| helm upgrade -f datadog-values.yaml <RELEASE_NAME> datadog/datadog | ||
| ``` | ||
|
|
||
| {{% /tab %}} | ||
| {{% tab "Datadog Operator" %}} | ||
|
|
||
| 1. Install the Datadog Operator with an option that grants the Datadog Agent permission to collect custom resources: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be updated to signify that it requires operator v1.20+ |
||
|
|
||
| ``` | ||
| helm install datadog-operator datadog/datadog-operator --set clusterRole.allowReadAllResources=true | ||
| ``` | ||
|
|
||
| 1. Add the following configuration to your `DatadogAgent` manifest, `datadog-agent.yaml`: | ||
|
|
||
| ```yaml | ||
| apiVersion: datadoghq.com/v2alpha1 | ||
| kind: DatadogAgent | ||
| metadata: | ||
| name: datadog | ||
| spec: | ||
| #(...) | ||
| features: | ||
| kubeStateMetricsCore: | ||
| collectCrMetrics: | ||
| - <CUSTOM_RESOURCE_METRIC> | ||
| ``` | ||
|
|
||
| Replace `<CUSTOM_RESOURCE_METRIC>` with the definitions you wrote in the first step. | ||
|
|
||
| 1. Apply your new configuration: | ||
|
|
||
| ``` | ||
| kubectl apply -n $DD_NAMESPACE -f datadog-agent.yaml | ||
| ``` | ||
|
|
||
| {{% /tab %}} | ||
| {{< /tabs >}} | ||
|
|
||
| ## Further reading | ||
|
|
||
| {{< partial name="whats-next/whats-next.html" >}} | ||
|
|
@@ -420,4 +523,4 @@ | |
| [2]: /infrastructure/containers | ||
| [3]: https://app.datadoghq.com/orchestration/explorer/pod | ||
| [4]: https://app.datadoghq.com/orchestration/explorer/crd | ||
|
|
||
| [5]: https://github.com/kubernetes/kube-state-metrics/blob/main/docs/metrics/extend/customresourcestate-metrics.md | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear in this doc that this would result in a metric named (I am assuming)
kubernetes_state_customresource.eniconfigThe
kubernetes_state_customresourceprefix behavior should be called out somewhere in this docLikewise, the behavior when the a
metricNamePrefixis specified should also be documented (it would result in a metric likekubernetes_state_customresource.<metricNamePrefix>_<metricName>