on 04 Jun 2026 06:53 PM
Table of Contents
Kubernetes Platform Monitoring is ingesting a set of Kubernetes resources from the Kube-APIserver on the monitored Kubernetes cluster and present those resources as metrics in Dynatrace, e.g(workload metrics (CPU, Memory), namespace resource quotas,......,etc)
In some scenarios, those Kubernetes resources are not enough and customers might need to ingest additional Kubernetes resources from a monitored cluster, and setup an alert based on the ingested resources metric value.
Ingesting additional Kubernetes Custom Resources (CRs) from a monitored Kubernetes cluster that is not ingested into Dynatrace out of the box and present this Custom Resources as a metric in Dynatrace to be able to setup an alerting if the value of this metric breached a configured threshold value.
Ingesting additional Custom Resources from Kubernetes cluster as Smartscape nodes:
For the below steps, we will Ingest additional Custom Resource (ClusterResourceQuota) from a monitored OpenShift Cluster as an example:
Step 1: Add the new permissions to the ClusterRole:
Please refer to this link to extend the permissions for Kubernetes Platform monitoring, by creating a ClusterRole with the required permissions and bind it to the dynatrace-activegate service account using a ClusterRoleBinding, below are the needed permissions to ingest ClusterResourceQuota CR from a monitored OpenShift Cluster:
- verbs: - list - watch - get apiGroups: - quota.openshift.io resources: - clusterresourcequotas
Step 2: Modify the ActiveGate's customProperties to include kubernetes_smartscape_monitored_custom_resources parameter for Kubernetes monitoring in the DynaKube YAML file:
Please refer to this link to extend monitoring of custom resources (CRs) using kubernetes_smartscape_monitored_custom_resources parameter on the ActiveGate's customProperties, below are the parameter's values needed to ingest ClusterResourceQuota CR from a monitored OpenShift Cluster:
spec:
activeGate:
capabilities:
- kubernetes-monitoring
customProperties:
value: |
[kubernetes_monitoring]
kubernetes_smartscape_monitored_custom_resources = [{ "resource": "clusterresourcequotas"\, "kind": "ClusterResourceQuota"\, "apiGroup": "quota.openshift.io"\, "version": "v1"\, "namespaced": false\, "usePreferredApiVersion": false }]
Note: The resource value must be the lowercase plural name of the resource, and kind must match the Kubernetes kind exactly (PascalCase). Optionally, set usePreferredApiVersion for ActiveGate to use the preferred API version (if the preferred version can’t be determined, the version specified in version is used as a fallback).
Once the new permissions has been added to the ClusterRole and the ActiveGate's customProperties modified to include the kubernetes_smartscape_monitored_custom_resources parameter successfully, you can query the data via the below DQL query:
smartscapeNodes K8S_CLUSTERRESOURCEQUOTA
Step 3: After successfully querying the K8S_CLUSTERRESOURCEQUOTA via the provided DQL query, you can create a workflow to read the smartscapeNode 'K8S_CLUSTERRESOURCEQUOTA' every 1 minute or so, extract the data and ingest it as custom metric:
Please refer to this link to create a Workflow with DQL query and HTTP request actions, attached to the article an example Workflow JSON file 'clusterresourcequota-pods-used-metric.workflow.json' that can be uploaded to a Dynatrace environment on the Workflow app to perform the below:
<DT-SaaS-FQDN> with the FQDN of your SaaS environment. <OCP-CLUSTER-NAME> with the name of the OpenShift cluster where you modified the ActiveGate's customProperties for Kubernetes monitoring in the DynaKube YAML to include kubernetes_smartscape_monitored_custom_resources parameter and added the new permissions to the ClusterRole,<token-value> with an access token with metrics.ingest scopeReferences:
https://docs.dynatrace.com/docs/shortlink/operator-security-rbac#activegate
https://docs.dynatrace.com/docs/shortlink/custom-properties-file
https://docs.dynatrace.com/docs/shortlink/semantic-dictionary-smartscape-kubernetes