Skip to content

Instantly share code, notes, and snippets.

@feczo
Created May 28, 2024 01:00
Show Gist options
  • Save feczo/896b32e7e1d6458594bca6ce8ba756b1 to your computer and use it in GitHub Desktop.
Save feczo/896b32e7e1d6458594bca6ce8ba756b1 to your computer and use it in GitHub Desktop.

Cluster State Metrics

DESCRIPTION NAME IN KUBE-STATE-METRICS COMMAND
Running pods kube_pod_status_phase kubectl get pods
Number of pods desired for a Deployment kube_deployment_spec_replicas kubectl get deployment
Number of pods desired for a DaemonSet kube_daemonset_status_desired_number_scheduled kubectl get daemonset
Number of pods currently running in a Deployment kube_deployment_status_replicas kubectl get deployment
Number of pods currently running in a DaemonSet kube_daemonset_status_current_number_scheduled kubectl get daemonset
Number of pods currently available in a Deployment kube_deployment_status_replicas_available kubectl get deployment
Number of pods currently available in a DaemonSet kube_daemonset_status_number_available kubectl get daemonset
Number of pods currently not available in a Deployment kube_deployment_status_replicas_unavailable kubectl get deployment
Number of pods currently not available in a DaemonSet kube_daemonset_status_number_unavailable kubectl get daemonset

Node Resource and Status Metrics

DESCRIPTION NAME IN KUBE-STATE-METRICS COMMAND
Current health status of a node (kubelet) kube_node_status_condition kubectl describe node
Total memory requests (bytes) per node kube_pod_container_resource_requests_memory_bytes kubectl describe node
Total memory in use on a node N/A kubectl describe node
Total CPU requests (cores) per node kube_pod_container_resource_requests_cpu_cores kubectl describe node
Total CPU in use on a node N/A kubectl describe node

Job Metrics

DESCRIPTION NAME IN KUBE-STATE-METRICS COMMAND
Number of successful jobs kube_job_status_succeeded `kubectl get jobs --all-namespaces
Number of failed jobs kube_job_status_failed `kubectl get jobs --all-namespaces
Number of active jobs kube_job_status_active kubectl get jobs --all-namespaces
Number of CronJobs kube_cronjob_info kubectl get cronjobs --all-namespaces

Service Metrics

DESCRIPTION NAME IN KUBE-STATE-METRICS COMMAND
Service types per cluster kube_service_info kubectl get services --all-namespaces
Number of pods running by service N/A kubectl get pods --selector=<service-name>=<service-value> -o=name

Container Metrics

DESCRIPTION NAME IN KUBE-STATE-METRICS COMMAND
Containers running on a pod kube_pod_container_info kubectl describe pod
Containers restarted on a pod kube_pod_container_status_restarts_total kubectl describe pod
Containers terminated on a pod kube_pod_container_status_terminated kubectl describe pod

Disk I/O & Network Metrics

DESCRIPTION PROMETHEUS METRIC NAME COMMAND
Network in per node container container_network_receive_bytes_total kubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics/cadvisor
Network out per node container container_network_transmit_bytes_total kubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics/cadvisor
Disk writes per node container container_fs_writes_bytes_total kubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics/cadvisor
Disk reads per node container container_fs_reads_bytes_total kubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics/cadvisor
Network errors per node container container_network_receive/transmit_errors_total kubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics/cadvisor

Kubernetes Events

DESCRIPTION COMMAND
List events kubectl get events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment