Kubernetes (K8s) monitoring

SkyWalking leverages K8s kube-state-metrics (KSM) and cAdvisor for collecting metrics data from K8s. It leverages OpenTelemetry Collector to transfer the metrics to OpenTelemetry receiver and into the Meter System. This feature requires authorizing the OAP Server to access K8s's API Server.

Data flow

  1. K8s kube-state-metrics and cAdvisor collect metrics data from K8s.
  2. OpenTelemetry Collector fetches metrics from kube-state-metrics and cAdvisor via Prometheus Receiver and pushes metrics to SkyWalking OAP Server via the OpenCensus gRPC Exporter or OpenTelemetry gRPC exporter.
  3. The SkyWalking OAP Server access to K8s's API Server gets meta info and parses the expression with MAL to filter/calculate/aggregate and store the results.

Setup

  1. Setup kube-state-metric.
  2. cAdvisor is integrated into kubelet by default.
  3. Set up OpenTelemetry Collector . For details on Prometheus Receiver in OpenTelemetry Collector for K8s, refer to here. For a quick start, we have provided a complete example of configuration and recommended version; you can refer to showcase.
  4. Config SkyWalking OpenTelemetry receiver.

Kubernetes Cluster Monitoring

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 PanelUnitMetric NameDescriptionData Source
Node Totalk8s_cluster_node_totalThe number of nodesK8s kube-state-metrics
Namespace Totalk8s_cluster_namespace_totalThe number of namespacesK8s kube-state-metrics
Deployment Totalk8s_cluster_deployment_totalThe number of deploymentsK8s kube-state-metrics
Service Totalk8s_cluster_service_totalThe number of servicesK8s kube-state-metrics
Pod Totalk8s_cluster_pod_totalThe number of podsK8s kube-state-metrics
Container Totalk8s_cluster_container_totalThe number of containersK8s kube-state-metrics
CPU Resourcesmk8s_cluster_cpu_cores
k8s_cluster_cpu_cores_requests
k8s_cluster_cpu_cores_limits
k8s_cluster_cpu_cores_allocatable
The capacity and the Requests / Limits / Allocatable of the CPUK8s kube-state-metrics
Memory ResourcesGik8s_cluster_memory_total
k8s_cluster_memory_requests
k8s_cluster_memory_limits
k8s_cluster_memory_allocatable
The capacity and the Requests / Limits / Allocatable of the memoryK8s kube-state-metrics
Storage ResourcesGik8s_cluster_storage_total
k8s_cluster_storage_allocatable
The capacity and allocatable of the storageK8s kube-state-metrics
Node Statusk8s_cluster_node_statusThe current status of the nodesK8s kube-state-metrics
Deployment Statusk8s_cluster_deployment_statusThe current status of the deploymentK8s kube-state-metrics
Deployment Spec Replicask8s_cluster_deployment_spec_replicasThe number of desired pods for a deploymentK8s kube-state-metrics
Service Statusk8s_cluster_service_pod_statusThe services current status, depending on the related pods' statusK8s kube-state-metrics
Pod Status Not Runningk8s_cluster_pod_status_not_runningThe pods which are not running in the current phaseK8s kube-state-metrics
Pod Status Waitingk8s_cluster_pod_status_waitingThe pods and containers which are currently in the waiting status, with reasons shownK8s kube-state-metrics
Pod Status Terminatedk8s_cluster_container_status_terminatedThe pods and containers which are currently in the terminated status, with reasons shownK8s kube-state-metrics

Kubernetes Cluster Node Supported Metrics

Monitoring PanelUnitMetric NameDescriptionData Source
Pod Totalk8s_node_pod_totalThe number of pods in this nodeK8s kube-state-metrics
Node Statusk8s_node_node_statusThe current status of this nodeK8s kube-state-metrics
CPU Resourcesmk8s_node_cpu_cores
k8s_node_cpu_cores_allocatable
k8s_node_cpu_cores_requests
k8s_node_cpu_cores_limits
The capacity and the requests / Limits / Allocatable of the CPUK8s kube-state-metrics
Memory ResourcesGik8s_node_memory_total
k8s_node_memory_allocatable
k8s_node_memory_requests
k8s_node_memory_limits
The capacity and the requests / Limits / Allocatable of the memoryK8s kube-state-metrics
Storage ResourcesGik8s_node_storage_total
k8s_node_storage_allocatable
The capacity and allocatable of the storageK8s kube-state-metrics
CPU Usagemk8s_node_cpu_usageThe total usage of the CPU core, if there are 2 cores the maximum usage is 2000mcAdvisor
Memory UsageGik8s_node_memory_usageThe totaly memory usagecAdvisor
Network I/OKB/sk8s_node_network_receive
k8s_node_network_transmit
The network receive and transmitcAdvisor

Kubernetes Service Monitoring

K8s Service Monitoring provides observabilities into service status and resources from Kubernetes. K8s Service as a Service in OAP and land on the Layer: K8S_SERVICE.

Kubernetes Service Supported Metrics

Monitoring PanelUnitMetric NameDescriptionData Source
Service Pod Totalk8s_service_pod_totalThe number of podsK8s kube-state-metrics
Service Pod Statusk8s_service_pod_statusThe current status of podsK8s kube-state-metrics
Service CPU Resourcesmk8s_service_cpu_cores_requests
k8s_service_cpu_cores_limits
The CPU resources requests / Limits of this serviceK8s kube-state-metrics
Service Memory ResourcesMBk8s_service_memory_requests
k8s_service_memory_limits
The memory resources requests / Limits of this serviceK8s kube-state-metrics
Pod CPU Usagemk8s_service_pod_cpu_usageThe CPU resources total usage of podscAdvisor
Pod Memory UsageMBk8s_service_pod_memory_usageThe memory resources total usage of podscAdvisor
Pod Waitingk8s_service_pod_status_waitingThe pods and containers which are currently in the waiting status, with reasons shownK8s kube-state-metrics
Pod Terminatedk8s_service_pod_status_terminatedThe pods and containers which are currently in the terminated status, with reasons shownK8s kube-state-metrics
Pod Restartsk8s_service_pod_status_restarts_totalThe number of per container restarts related to the podsK8s kube-state-metrics

Customizations

You can customize your own metrics/expression/dashboard panel. The metrics definition and expression rules are found in /config/otel-rules/k8s-cluster.yaml,/config/otel-rules/k8s-node.yaml, /config/otel-rules/k8s-service.yaml. The K8s Cluster dashboard panel configurations are found in /config/ui-initialized-templates/k8s. The K8s Service dashboard panel configurations are found in /config/ui-initialized-templates/k8s_service.