github.com/galamsiva2020/kubernetes-heapster-monitoring@v0.0.0-20210823134957-3c1baa7c1e70/docs/model.md (about) 1 # Heapster Metric Model 2 3 The Heapster Model is a structured representation of metrics for Kubernetes clusters, which is exposed through a set of REST API endpoints. 4 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). 5 6 **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.** 7 8 ## Deprecated 9 10 ** The Heapster Model API is deprecated. Please use the metrics APIs in [k8s.io/metrics](https://github.com/kubernetes/metrics) or retrieve data directly from a sink. ** 11 12 We will not be making changes to or supporting the model API in the future, and do not recommend its use. 13 14 ### Why? 15 16 The model API does not conform to the standards of a Kubernetes API. It cannot be easily aggregated, 17 does not have autogenerated serialization and clients for its types, and does has a number of 18 corner cases in its design that cause it to fail to display metrics in certain case. 19 20 Within Kubernetes, its use been replaced by the resource metrics API and custom metrics API, found in 21 the [k8s.io/metrics](https://github.com/kubernetes/metrics) repository. New applications that need 22 metrics are encouraged to use these APIs instead. They are provided by [metrics-server](https://github.com/kubernetes-incubator/metrics-server) and [custom metrics adapters](https://github.com/kubernetes-incubator/custom-metrics-apiserver) respectively. 23 24 ## Usage 25 26 The Heapster Model is enabled by default. The resolution of the model can be configured through 27 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. 28 29 ## API documentation 30 31 A detailed documentation of each API endpoint is listed below. 32 33 All endpoints ending in `/metrics/{metric-name}/` can accept the optional `start` and `end` query parameters 34 that represent the start and end time of the requested timeseries. The result 35 will be a list of (Timestamp, Value) pairs in the time range [start, end]. 36 `start` and `end` are strings formatted according to RFC3339. If `start` is not 37 defined, it is assumed as the zero Unix epoch time. If `end` is not defined, 38 then all data later than `start` will be returned. 39 40 ### Cluster-level Metrics 41 42 `/api/v1/model/metrics/`: Returns a list of available cluster-level metrics. 43 44 `/api/v1/model/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 45 pairs for the requested cluster-level metric, between the time range specified by `start` and `end`. 46 47 ### Node-level Metrics 48 `/api/v1/model/nodes/`: Returns a list of all available nodes. 49 50 `/api/v1/model/nodes/{node-name}/metrics/`: Returns a list of available 51 node-level metrics. 52 53 `/api/v1/model/nodes/{node-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 54 pairs for the requested node-level metric, within the time range specified by `start` and `end`. 55 56 ### Namespace-level Metrics 57 `/api/v1/model/namespaces/`: Returns a list of all available namespaces. 58 59 `/api/v1/model/namespaces/{namespace-name}/metrics/`: Returns a list of available namespace-level metrics. 60 61 `/api/v1/model/namespaces/{namespace-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 62 pairs for the requested namespace-level metric, within the time range specified by `start` and `end`. 63 64 65 ### Pod-level Metrics 66 `/api/v1/model/namespaces/{namespace-name}/pods/`: Returns a list of all available pods under a given namespace. 67 68 `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/`: Returns a list of available pod-level metrics 69 70 `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 71 pairs for the requested pod-level metric, within the time range specified by `start` and `end`. 72 73 ### Container-level Metrics 74 Container metrics and stats are accessible for both containers that belong to 75 pods, as well as for free containers running in each node. 76 77 `/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. 78 79 `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/metrics/`: Returns a list of available container-level metrics 80 81 `/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) 82 pairs for the requested container-level metric, within the time range specified by `start` and `end`. 83 84 `/api/v1/model/nodes/{node-name}/freecontainers/`: Returns a list of all available free containers under a given node. 85 86 `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/`: Returns a list of available container-level metrics 87 88 `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 89 pairs for the requested container-level metric, within the time range specified by `start` and `end`. 90 91 ### Metric Types 92 93 All metrics available in the [storage schema](storage-schema.md) are also available through the api.