Overview
The Kubernetes API Server is the central management entity that exposes the Kubernetes API. All kubectl commands, cluster components, and external clients interact with it.
Why it’s Useful
- Detects slow API calls or high error rates.
- Identifies request bottlenecks impacting cluster operations.
- Ensures cluster remains responsive under load.
What Users Can Do
- Monitor API latency and error rates.
- Adjust scrape intervals for fine-grained monitoring.
- Troubleshoot failed requests and downtime issues.
Steps to Configure
- Get the existing ConfigMap.
kubectl get cm opsramp-k8s-infra-metric-user-config -n <agent-installed-namespace> -o yaml - Edit the ConfigMap.
kubectl edit cm opsramp-k8s-infra-metric-user-config -n <agent-installed-namespace> - Locate the
apiserversection in ConfigMap.k8s_cluster: enabled: true config: scrape_interval: "2m" - Update the required parameters.
- Save and apply the changes.
Supported Metrics
| Metric Name | Description |
|---|---|
| aggregator_discovery_aggregation_count | Number of aggregated discovery requests served by the API aggregator. |
| aggregator_unavailable_apiservice | Indicates if an API service registered with the aggregator is currently unavailable. |
| apiextensions_apiserver_validation_ratcheting_seconds | Time taken by the API extensions server to validate and apply ratcheting for CRD updates. |
| apiextensions_openapi_v2_regeneration | Tracks regeneration events for OpenAPI V2 specifications by the API extensions server. |
| apiextensions_openapi_v3_regeneration | Tracks regeneration events for OpenAPI V3 specifications by the API extensions server. |
| apiserver_storage_objects | Total number of stored objects per resource type in etcd. |
| apiserver_admission_controller_admission_duration_seconds | Time taken by admission controllers to admit or deny incoming API requests. |
| apiserver_admission_step_admission_duration_seconds | Duration of each admission control step within the API server request flow. |
| apiserver_admission_step_admission_duration_seconds_summary | Summary statistics of admission step durations within the API server. |
| apiserver_audit_event | Number of audit events generated by the API server. |
| apiserver_audit_requests_rejected | Count of audit events rejected due to misconfiguration or buffer overflow. |
| apiserver_authorization_decisions | Number of authorization decisions made (allowed or denied) by the API server. |
| apiserver_cache_list_fetched_objects | Number of objects fetched during list operations served from cache. |
| apiserver_cache_list_returned_objects | Number of objects returned by list operations from the cache. |
| apiserver_cache_list | Tracks cache hit and miss rates for API list requests. |
| apiserver_cel_compilation_duration_seconds | Duration to compile CEL (Common Expression Language) expressions in admission webhooks. |
| apiserver_cel_evaluation_duration_seconds | Duration to evaluate CEL expressions during admission control. |
| apiserver_client_certificate_expiration_seconds | Time remaining before client certificates used by the API server expire. |
| apiserver_clusterip_repair_reconcile_errors | Number of errors encountered while reconciling cluster IP allocations. |
| apiserver_current_inflight_requests | Number of active requests currently being processed by the API server. |
| apiserver_current_inqueue_requests | Number of requests currently waiting in the API server request queue. |
| apiserver_envelope_encryption_dek_cache_fill_percent | Percentage of the encryption key cache filled for envelope encryption. |
| apiserver_flowcontrol_current_executing_requests | Number of currently executing requests under API Priority and Fairness (APF) control. |
| apiserver_flowcontrol_current_executing_seats | Number of active execution "seats" used by requests in APF. |
| apiserver_flowcontrol_current_inqueue_requests | Number of queued requests under API Priority and Fairness control. |
| apiserver_flowcontrol_current_inqueue_seats | Number of queue "seats" occupied by waiting requests. |
| apiserver_flowcontrol_current_limit_seats | Current limit of total execution seats available for requests. |
| apiserver_flowcontrol_demand_seats_average | Average number of seats demanded by incoming requests over time. |
| apiserver_flowcontrol_demand_seats_high_watermark | Highest observed number of seats demanded by requests. |
| apiserver_flowcontrol_demand_seats_stdev | Standard deviation of request seat demand over time. |
| apiserver_flowcontrol_dispatch_r | Dispatch rate of requests under APF scheduling. |
| apiserver_flowcontrol_dispatched_requests | Total number of dispatched requests under APF. |
| apiserver_flowcontrol_priority_level_request_utilization | Ratio of utilized vs. available request concurrency per priority level. |
| apiserver_flowcontrol_priority_level_seat_utilization | Utilization rate of available request execution seats per priority level. |
| apiserver_flowcontrol_read_vs_write_current_requests | Tracks ratio of concurrent read vs. write operations in APF. |
| apiserver_flowcontrol_request_concurrency_in_use | Number of concurrent requests currently in execution. |
| apiserver_flowcontrol_request_execution_seconds | Duration of request execution for API Priority and Fairness flows. |
| apiserver_flowcontrol_request_queue_length_after_enqueue | Queue length after new requests are enqueued. |
| apiserver_flowcontrol_request_wait_duration_seconds | Time spent by requests waiting in the queue before execution. |
| apiserver_flowcontrol_seat_fair_frac | Fraction of seats allocated fairly among competing requests. |
| apiserver_flowcontrol_target_seats | Target number of execution seats under APF configuration. |
| apiserver_flowcontrol_upper_limit_seats | Upper threshold for concurrent execution seats. |
| apiserver_flowcontrol_watch_count_samples | Number of watch event samples processed by APF. |
| apiserver_flowcontrol_work_estimated_seats | Estimated number of seats required per unit of request work. |
| apiserver_init_events | Initialization events triggered during API server startup. |
| apiserver_kube_aggregator_x509_insecure_sha1 | Count of certificates using insecure SHA1 signatures detected by the aggregator. |
| apiserver_kube_aggregator_x509_missing_san | Number of certificates missing Subject Alternative Name (SAN) entries. |
| apiserver_longrunning_requests | Number of currently active long-running requests (e.g., watch streams). |
| apiserver_nodeport_repair_reconcile_errors | Errors encountered during NodePort repair reconciliation. |
| apiserver_request_aborts | Number of API requests aborted before completion. |
| apiserver_request_body_size_bytes | Distribution of API request body sizes in bytes. |
| apiserver_request_duration_seconds | Overall latency of API requests from receipt to completion. |
| apiserver_request_filter_duration_seconds | Time spent filtering requests by admission or authorization layers. |
| apiserver_request_post_timeout | Number of requests that timed out after processing began. |
| apiserver_request_sli_duration_seconds | Service Level Indicator (SLI) for request latency duration. |
| apiserver_request_terminations | Number of API requests forcefully terminated by the server. |
| apiserver_request_timestamp_comparison_time | Latency in comparing timestamps during request validation. |
| apiserver_request | Total count of API requests received by the server. |
| apiserver_response_sizes | Distribution of response payload sizes returned by the API server. |
| apiserver_selfrequest | Internal requests made by the API server to itself for health or sync operations. |
| apiserver_storage_data_key_generation_duration_seconds | Time taken to generate data encryption keys for storage operations. |
| apiserver_storage_data_key_generation_failures | Number of failures during encryption key generation for data storage. |
| apiserver_storage_envelope_transformation_cache_misses | Number of cache misses during envelope encryption/decryption transformations. |
| apiserver_storage_events_received | Total number of etcd storage events received by the API server. |
| apiserver_storage_list_evaluated_objects | Number of objects evaluated by list operations in storage requests. |
| apiserver_storage_list_fetched_objects | Number of objects fetched by list operations from etcd storage. |
| workqueue_work_duration_seconds | Time taken by workqueue tasks to complete processing. |