# Monitoring cluster state Managed Service for Kubernetes

Managed Service for Kubernetes automatically sends cluster metrics to [Yandex Monitoring](../../../monitoring/index.md). Metrics are available for the following Kubernetes objects:

* Container
* [Master](../../concepts/index.md#master)
* [Node](../../concepts/index.md#node-group)
* [Pod](../../concepts/index.md#pod)
* [Persistent volume](../../concepts/volume.md#persistent-volume)

You can find metrics description in [Yandex Monitoring metric reference](../../metrics.md).

## How to get statistics {#methods}

There are several alternative ways:

* [View the statistics in the management console](#console). It shows only the metrics for your master, nodes, and pods.
* [Open the Monitoring web interface](#monitoring). It shows all Managed Service for Kubernetes metrics.
* [Export metrics](../../../monitoring/operations/metric/get.md) using the Monitoring API. Thus you can get only numerical values of metrics without visualization.
* [Install Metrics Provider](../applications/metrics-provider.md). You can use it to transmit metrics in two directions:

   * From Kubernetes objects to monitoring systems and [automatic scaling systems](../../concepts/autoscale.md)
   * From Monitoring to Kubernetes objects


* [Install Prometheus Operator](../applications/prometheus-operator.md) to use the [Yandex Managed Service for Prometheus®](../../../monitoring/operations/prometheus/index.md) monitoring system. This way you can work with dashboards in [Grafana](https://grafana.com/grafana/) and take advantage of [Prometheus](https://prometheus.io/docs/introduction/overview/).


## Viewing statistics in the management console {#console}

### Viewing master statistics {#master}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), go to the Managed Service for Kubernetes cluster page.
  1. Under **Overview**, go to the **Master** tab.

      Widgets with Managed Service for Kubernetes master metrics will open. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-master-metrics).

   1. Specify the period to view the statistics for.

      Charts on the widgets will be automatically updated.

{% endlist %}

### Viewing node statistics {#node}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), go to the Managed Service for Kubernetes cluster page.
  1. Under **Node management**, go to the **Nodes** tab.
  1. Open the page of the node whose statistics you want to view.
  1. Go to the **Monitoring** tab.

      Widgets with Managed Service for Kubernetes node metrics will open. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-node-metrics).

      Widgets only show some of the available metrics. All metrics are available in [Monitoring](#monitoring).

  1. Specify the period to view the statistics for.

      Charts on the widgets will be automatically updated.

{% endlist %}

### Viewing pod statistics {#pod}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), go to the Managed Service for Kubernetes cluster page.
  1. In the left-hand panel, select **Workload**.
  1. Open the page of the pod whose statistics you want to view.
  1. Go to the **Monitoring** tab.

     Widgets with Managed Service for Kubernetes pod metrics will open. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-pod-metrics).

     Widgets only show some of the available metrics. All metrics are available in [Monitoring](#monitoring).

  1. Specify the period to view the statistics for.

     Charts on the widgets will be automatically updated.

{% endlist %}

## Viewing statistics in Monitoring {#monitoring}

1. Open the Monitoring [home page](https://monitoring.yandex.cloud).
1. In the left-hand panel, select **Metrics**.
1. In the request field, click ![image](../../../_assets/console-icons/code.svg).
1. [Make a request for statistics](#requests-in-monitoring).
1. Specify the period to view the statistics for.
1. Click **Run**.

### Requests for statistics in Monitoring {#requests-in-monitoring}

* For a Managed Service for Kubernetes **container**:

   ```
   "<metric>"{folderId="<folder_ID>", service="managed-kubernetes", cluster_id="<cluster_name>", container="<container_name>"}
   ```

   In the request, specify the following parameters:

   * `"<metric>"`: Container metric name, e.g., `"container.cpu.core_usage_time"`. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-container-metrics).
   * `folderId`: Folder ID.
   * `cluster_id`: Managed Service for Kubernetes cluster name.
   * `container`: Name of the container you need the statistics for.

* For a Managed Service for Kubernetes **master**:

   ```
   "<metric>"{folderId="<folder_ID>", service="managed-kubernetes", cluster_id="<cluster_name>"}
   ```

   In the request, specify the following parameters:

   * `"<metric>"`: Container metric name, e.g., `"master.cpu.utilization_percent"`. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-master-metrics).
   * `folderId`: Folder ID.
   * `cluster_id`: Managed Service for Kubernetes cluster name.

* For a Managed Service for Kubernetes **node**:

   ```
   "<metric>"{folderId="<folder_ID>", service="managed-kubernetes", cluster_id="<cluster_name>", node="<node_name>"}
   ```

   In the request, specify the following parameters:

   * `"<metric>"`: Container metric name, e.g., `"node.cpu.core_usage_time"`. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-node-metrics).
   * `folderId`: Folder ID.
   * `cluster_id`: Managed Service for Kubernetes cluster name.
   * `node`: Name of the node you need the statistics for.

* For a Managed Service for Kubernetes **pod**:

   ```
   "<metric>"{folderId="<folder_ID>", service="managed-kubernetes", cluster_id="<cluster_name>", pod="<pod_name>"}
   ```

   In the request, specify the following parameters:

   * `"<metric>"`: Container metric name, e.g., `"pod.memory.used_bytes"`. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-pod-metrics).
   * `folderId`: Folder ID.
   * `cluster_id`: Managed Service for Kubernetes cluster name.
   * `pod`: Name of the pod you need the statistics for.

* For a Managed Service for Kubernetes **persistent volume claim (PVC)**:

   ```
   "<metric>"{folderId="<folder_ID>", service="managed-kubernetes", cluster_id="<cluster_name>", persistentvolumeclaim="<PVC_name>"}
   ```

   In the request, specify the following parameters:

   * `"<metric>"`: Container metric name, e.g., `"pod.memory.used_bytes"`. The metrics are listed in the [reference](../../metrics.md#managed-kubernetes-persistent-volume-metrics).
   * `folderId`: Folder ID.
   * `cluster_id`: Managed Service for Kubernetes cluster name.
   * `persistentvolumeclaim`: Name of the persistent volume you need the statistics for.