[Yandex Cloud documentation](../../../index.md) > [Yandex Managed Service for Kubernetes](../../index.md) > [Step-by-step guides](../index.md) > Managing a Kubernetes cluster > Viewing operations with a Kubernetes cluster

# Viewing operations with a Managed Service for Kubernetes cluster

The system logs all actions with Managed Service for Kubernetes resources as a list of operations. Each operation gets its own unique [ID](../../../api-design-guide/concepts/about-async.md).

Operations enable real-time monitoring of actions with your cluster. This may be relevant in automating infrastructure creation, where the state of an operation determines the next steps. For example, before creating a node group, you need to track the status of the cluster creation operation.

 The service retains operation records for a limited time. To monitor the state of the cluster and log actions with it, use [Yandex Monitoring](../../metrics.md), [Yandex Cloud Logging](../../tutorials/k8s-fluent-bit-logging.md), and [Yandex Audit Trails](../../at-ref.md).

## Getting a list of operations {#get-operations}

{% list tabs group=instructions %}

- Management console {#console}

  To view operations with all [Kubernetes clusters](../../concepts/index.md#kubernetes-cluster), select ![image](../../../_assets/console-icons/list-check.svg) **Operations** in the left-hand panel. The list that opens also includes operations with the clusters you deleted.

  You can get a list of operations for a specific cluster:

  1. In the [management console](https://console.yandex.cloud), open the folder containing the cluster.
  1. Navigate to **Managed Service for&nbsp;Kubernetes**.
  1. Select the cluster and open the ![image](../../../_assets/console-icons/list-check.svg) **Operations** tab.

     You will see the list of operations with the cluster.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To get a list of operations for a Managed Service for Kubernetes cluster, run this command:

  ```bash
  yc managed-kubernetes cluster list-operations <cluster_name_or_ID>
  ```

  Result:

  ```text
  +----------------------+---------------------+----------------------+---------------------+--------+----------------+
  |          ID          |     CREATED AT      |      CREATED BY      |     MODIFIED AT     | STATUS |  DESCRIPTION   |
  +----------------------+---------------------+----------------------+---------------------+--------+----------------+
  | cat5g6mqaccn******** | 2024-05-14 18:40:02 | aje9k8luj4qf******** | 2024-05-14 18:40:03 | DONE   | Update cluster |
  | cati1flsiarv******** | 2024-05-14 18:29:13 | aje9k8luj4qf******** | 2024-05-14 18:36:17 | DONE   | Create cluster |
  +----------------------+---------------------+----------------------+---------------------+--------+----------------+
  ```

  By default, information about operations is output as text. To get more details, specify `yaml` or `json` for the output data using the `--format` argument:

  ```bash
  yc managed-kubernetes cluster list-operations <cluster_name_or_ID> --format yaml
  ```

  Result:

  ```text
  - id: cat5g6mqaccn********
    description: Update cluster
    created_at: "2024-05-14T18:40:02Z"
    created_by: aje9k8luj4qf********
    modified_at: "2024-05-14T18:40:03Z"
    done: true
    metadata:
      '@type': type.googleapis.com/yandex.cloud.k8s.v1.UpdateClusterMetadata
      cluster_id: cathr91hiupd********
    response:
      '@type': type.googleapis.com/yandex.cloud.k8s.v1.Cluster
      id: cathr91hiupd********
      folder_id: b1g681qpemb4********
      created_at: "2024-05-14T18:29:13Z"
      name: my-k8s-logs
      status: RUNNING
      health: HEALTHY
      network_id: enpphqi8uvcm********
      ...
      service_account_id: ajeevjv1lv01********
      node_service_account_id: ajeevjv1lv01********
      release_channel: REGULAR
  - id: cati1flsiarv********
    description: Create cluster
    created_at: "2024-05-14T18:29:13Z"
    created_by: aje9k8luj4qf********
    modified_at: "2024-05-14T18:36:17Z"
    done: true
    metadata:
      '@type': type.googleapis.com/yandex.cloud.k8s.v1.CreateClusterMetadata
      cluster_id: cathr91hiupd********
    response:
      '@type': type.googleapis.com/yandex.cloud.k8s.v1.Cluster
      id: cathr91hiupd********
      folder_id: b1g681qpemb4********
      created_at: "2024-05-14T18:29:13Z"
      name: my-k8s
      status: RUNNING
      health: HEALTHY
      network_id: enpphqi8uvcm********
      ...
      node_service_account_id: ajeevjv1lv01********
      release_channel: REGULAR
  ```

- API {#api}

  Use either the [listOperations](../../managed-kubernetes/api-ref/Cluster/listOperations.md) REST API method for the [Cluster](../../managed-kubernetes/api-ref/Cluster/index.md) resource or the [ClusterService/ListOperations](../../managed-kubernetes/api-ref/grpc/Cluster/listOperations.md) gRPC API call.

{% endlist %}

## Getting operation details {#get-operations-info}

1. [Get a list of operations](#get-operations) for the Managed Service for Kubernetes cluster.
1. Copy the operation ID.
1. Get the operation details:

   {% list tabs group=instructions %}

   - CLI {#cli}

     If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

     The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

     Run this command:

     ```bash
     yc operation get <operation_ID>
     ```

     Result:

     ```text
     id: cat5g6mqaccn********
     description: Update cluster
     created_at: "2024-05-14T18:40:02Z"
     created_by: aje9k8luj4qf********
     modified_at: "2024-05-14T18:40:03Z"
     done: true
     metadata:
       '@type': type.googleapis.com/yandex.cloud.k8s.v1.UpdateClusterMetadata
       cluster_id: cathr91hiupd********
     response:
       '@type': type.googleapis.com/yandex.cloud.k8s.v1.Cluster
       id: cathr91hiupd********
       folder_id: b1g681qpemb4********
       created_at: "2024-05-14T18:29:13Z"
       name: my-k8s-logs
       status: RUNNING
       health: HEALTHY
       network_id: enpphqi8uvcm********
       ...
       service_account_id: ajeevjv1lv01********
       node_service_account_id: ajeevjv1lv01********
       release_channel: REGULAR
     ```

   - API {#api}

     Use the [get](../../managed-kubernetes/api-ref/Operation/get.md) REST API method for the [Operation](../../managed-kubernetes/api-ref/Operation/index.md) resource or the [OperationService/Get](../../managed-kubernetes/api-ref/grpc/Operation/get.md) gRPC API call.

   {% endlist %}

#### See also {#see-also}

* [Working with operations](../../../api-design-guide/concepts/about-async.md)