Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Latest commit

 

History

History
93 lines (58 loc) · 5.28 KB

model.md

File metadata and controls

93 lines (58 loc) · 5.28 KB

Heapster Metric Model

The Heapster Model is a structured representation of metrics for Kubernetes clusters, which is exposed through a set of REST API endpoints. It allows the extraction of up to 15 minutes of historical data for any Container, Pod, Node or Namespace in the cluster, as well as the cluster itself (depending on the metric).

Please bear in mind that this is not an official Kubernetes API, we will try to keep it stable but we don't guarantee that we won't change it in the future.

Deprecated

** The Heapster Model API is deprecated. Please use the metrics APIs in k8s.io/metrics or retrieve data directly from a sink. **

We will not be making changes to or supporting the model API in the future, and do not recommend its use.

Why?

The model API does not conform to the standards of a Kubernetes API. It cannot be easily aggregated, does not have autogenerated serialization and clients for its types, and does has a number of corner cases in its design that cause it to fail to display metrics in certain case.

Within Kubernetes, its use been replaced by the resource metrics API and custom metrics API, found in the k8s.io/metrics repository. New applications that need metrics are encouraged to use these APIs instead. They are provided by metrics-server and custom metrics adapters respectively.

Usage

The Heapster Model is enabled by default. The resolution of the model can be configured through the --metric_resolution flag, which will cause the model to store historical data at the specified resolution. If the --metric_resolution flag is not specified, the default resolution of 60 seconds will be used.

API documentation

A detailed documentation of each API endpoint is listed below.

All endpoints ending in /metrics/{metric-name}/ can accept the optional start and end query parameters that represent the start and end time of the requested timeseries. The result will be a list of (Timestamp, Value) pairs in the time range [start, end]. start and end are strings formatted according to RFC3339. If start is not defined, it is assumed as the zero Unix epoch time. If end is not defined, then all data later than start will be returned.

Cluster-level Metrics

/api/v1/model/metrics/: Returns a list of available cluster-level metrics.

/api/v1/model/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested cluster-level metric, between the time range specified by start and end.

Node-level Metrics

/api/v1/model/nodes/: Returns a list of all available nodes.

/api/v1/model/nodes/{node-name}/metrics/: Returns a list of available node-level metrics.

/api/v1/model/nodes/{node-name}/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested node-level metric, within the time range specified by start and end.

Namespace-level Metrics

/api/v1/model/namespaces/: Returns a list of all available namespaces.

/api/v1/model/namespaces/{namespace-name}/metrics/: Returns a list of available namespace-level metrics.

/api/v1/model/namespaces/{namespace-name}/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested namespace-level metric, within the time range specified by start and end.

Pod-level Metrics

/api/v1/model/namespaces/{namespace-name}/pods/: Returns a list of all available pods under a given namespace.

/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/: Returns a list of available pod-level metrics

/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested pod-level metric, within the time range specified by start and end.

Container-level Metrics

Container metrics and stats are accessible for both containers that belong to pods, as well as for free containers running in each node.

/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/: Returns a list of all available containers under a given pod. Note: Not Supported only in V1.2.0.

/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/metrics/: Returns a list of available container-level metrics

/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested container-level metric, within the time range specified by start and end.

/api/v1/model/nodes/{node-name}/freecontainers/: Returns a list of all available free containers under a given node.

/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/: Returns a list of available container-level metrics

/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/{metric-name}?start=X&end=Y: Returns a set of (Timestamp, Value) pairs for the requested container-level metric, within the time range specified by start and end.

Metric Types

All metrics available in the storage schema are also available through the api.