Support monitoring the total number metrics of k8s StatefulSet and DaemonSet. (#10639)

This commit is contained in:
innerpeacez 2023-04-05 00:41:01 +08:00 committed by GitHub
parent 76db1475ec
commit 2c26b98198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 29 deletions

View File

@ -26,6 +26,7 @@
* Fix `NPE` when query the not exist series indexes in ElasticSearch storage.
* Support collecting memory buff/cache metrics in VM monitoring.
* PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound.
* Support monitoring the total number metrics of k8s StatefulSet and DaemonSet.
#### UI
* Revert: cpm5d function. This feature is cancelled from backend.

View File

@ -18,24 +18,26 @@ For a quick start, we have provided a complete example of configuration and reco
K8s cluster monitoring provides monitoring of the status and resources of the whole cluster and each node. K8s cluster as a `Service` in OAP, K8s node as an `Instance` in OAP, and land on the `Layer: K8S`.
### Kubernetes Cluster Supported Metrics
| Monitoring Panel | Unit | Metric Name | Description | Data Source |
|-----|------|-----|-----|-----|
| Node Total | | k8s_cluster_node_total | The number of nodes | K8s kube-state-metrics|
| Namespace Total | | k8s_cluster_namespace_total | The number of namespaces | K8s kube-state-metrics|
| Deployment Total | | k8s_cluster_deployment_total | The number of deployments | K8s kube-state-metrics|
| Service Total | | k8s_cluster_service_total | The number of services | K8s kube-state-metrics|
| Pod Total | | k8s_cluster_pod_total | The number of pods | K8s kube-state-metrics|
| Container Total | | k8s_cluster_container_total | The number of containers | K8s kube-state-metrics|
| CPU Resources | m | k8s_cluster_cpu_cores<br />k8s_cluster_cpu_cores_requests<br />k8s_cluster_cpu_cores_limits<br />k8s_cluster_cpu_cores_allocatable | The capacity and the Requests / Limits / Allocatable of the CPU | K8s kube-state-metrics|
| Memory Resources | Gi | k8s_cluster_memory_total<br />k8s_cluster_memory_requests<br />k8s_cluster_memory_limits<br />k8s_cluster_memory_allocatable | The capacity and the Requests / Limits / Allocatable of the memory | K8s kube-state-metrics|
| Storage Resources | Gi | k8s_cluster_storage_total<br />k8s_cluster_storage_allocatable | The capacity and allocatable of the storage | K8s kube-state-metrics|
| Node Status | | k8s_cluster_node_status | The current status of the nodes | K8s kube-state-metrics|
| Deployment Status | | k8s_cluster_deployment_status | The current status of the deployment | K8s kube-state-metrics|
| Deployment Spec Replicas | | k8s_cluster_deployment_spec_replicas | The number of desired pods for a deployment | K8s kube-state-metrics|
| Service Status | | k8s_cluster_service_pod_status | The services current status, depending on the related pods' status | K8s kube-state-metrics|
| Pod Status Not Running | | k8s_cluster_pod_status_not_running | The pods which are not running in the current phase | K8s kube-state-metrics|
| Pod Status Waiting | | k8s_cluster_pod_status_waiting | The pods and containers which are currently in the waiting status, with reasons shown | K8s kube-state-metrics|
| Pod Status Terminated | | k8s_cluster_container_status_terminated | The pods and containers which are currently in the terminated status, with reasons shown | K8s kube-state-metrics|
| Monitoring Panel | Unit | Metric Name | Description | Data Source |
|--------------------------|------|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|------------------------|
| Node Total | | k8s_cluster_node_total | The number of nodes | K8s kube-state-metrics |
| Namespace Total | | k8s_cluster_namespace_total | The number of namespaces | K8s kube-state-metrics |
| Deployment Total | | k8s_cluster_deployment_total | The number of deployments | K8s kube-state-metrics |
| StatefulSet Total | | k8s_cluster_statefulset_total | The number of statefulsets | K8s kube-state-metrics |
| DaemonSet Total | | k8s_cluster_daemonset_total | The number of daemonsets | K8s kube-state-metrics |
| Service Total | | k8s_cluster_service_total | The number of services | K8s kube-state-metrics |
| Pod Total | | k8s_cluster_pod_total | The number of pods | K8s kube-state-metrics |
| Container Total | | k8s_cluster_container_total | The number of containers | K8s kube-state-metrics |
| CPU Resources | m | k8s_cluster_cpu_cores<br />k8s_cluster_cpu_cores_requests<br />k8s_cluster_cpu_cores_limits<br />k8s_cluster_cpu_cores_allocatable | The capacity and the Requests / Limits / Allocatable of the CPU | K8s kube-state-metrics |
| Memory Resources | Gi | k8s_cluster_memory_total<br />k8s_cluster_memory_requests<br />k8s_cluster_memory_limits<br />k8s_cluster_memory_allocatable | The capacity and the Requests / Limits / Allocatable of the memory | K8s kube-state-metrics |
| Storage Resources | Gi | k8s_cluster_storage_total<br />k8s_cluster_storage_allocatable | The capacity and allocatable of the storage | K8s kube-state-metrics |
| Node Status | | k8s_cluster_node_status | The current status of the nodes | K8s kube-state-metrics |
| Deployment Status | | k8s_cluster_deployment_status | The current status of the deployment | K8s kube-state-metrics |
| Deployment Spec Replicas | | k8s_cluster_deployment_spec_replicas | The number of desired pods for a deployment | K8s kube-state-metrics |
| Service Status | | k8s_cluster_service_pod_status | The services current status, depending on the related pods' status | K8s kube-state-metrics |
| Pod Status Not Running | | k8s_cluster_pod_status_not_running | The pods which are not running in the current phase | K8s kube-state-metrics |
| Pod Status Waiting | | k8s_cluster_pod_status_waiting | The pods and containers which are currently in the waiting status, with reasons shown | K8s kube-state-metrics |
| Pod Status Terminated | | k8s_cluster_container_status_terminated | The pods and containers which are currently in the terminated status, with reasons shown | K8s kube-state-metrics |
### Kubernetes Cluster Node Supported Metrics
| Monitoring Panel | Unit | Metric Name | Description | Data Source |

View File

@ -70,6 +70,12 @@ metricsRules:
- name: deployment_spec_replicas
exp: kube_deployment_spec_replicas.sum(['cluster' , 'deployment' , 'namespace'])
- name: statefulset_total
exp: kube_statefulset_labels.sum(['cluster'])
- name: daemonset_total
exp: kube_daemonset_labels.sum(['cluster'])
- name: service_total
exp: kube_service_info.sum(['cluster'])
- name: service_pod_status

View File

@ -295,9 +295,9 @@
"moved": false
},
{
"x": 20,
"x": 21,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "10",
"type": "Widget",
@ -319,9 +319,9 @@
"moved": false
},
{
"x": 16,
"x": 18,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "11",
"type": "Widget",
@ -343,9 +343,9 @@
"moved": false
},
{
"x": 12,
"x": 15,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "12",
"type": "Widget",
@ -369,7 +369,7 @@
{
"x": 0,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "13",
"type": "Widget",
@ -391,9 +391,9 @@
"moved": false
},
{
"x": 4,
"x": 3,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "14",
"type": "Widget",
@ -415,9 +415,9 @@
"moved": false
},
{
"x": 8,
"x": 6,
"y": 0,
"w": 4,
"w": 3,
"h": 6,
"i": "15",
"type": "Widget",
@ -437,6 +437,54 @@
"readMetricsValue"
],
"moved": false
},
{
"x": 9,
"y": 0,
"w": 3,
"h": 6,
"i": "17",
"type": "Widget",
"widget": {
"title": "StatefulSet Total"
},
"graph": {
"type": "Card",
"fontSize": 14,
"textAlign": "center",
"showUint": true
},
"metrics": [
"k8s_cluster_statefulset_total"
],
"metricTypes": [
"readMetricsValue"
],
"moved": false
},
{
"x": 12,
"y": 0,
"w": 3,
"h": 6,
"i": "18",
"type": "Widget",
"widget": {
"title": "DaemonSet Total"
},
"graph": {
"type": "Card",
"fontSize": 14,
"textAlign": "center",
"showUint": true
},
"metrics": [
"k8s_cluster_daemonset_total"
],
"metricTypes": [
"readMetricsValue"
],
"moved": false
}
]
},