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.
Operations enable you to monitor actions with your cluster in real-time. 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, Yandex Cloud Logging, and Yandex Audit Trails.
Getting a list of operations
To view operations with all Kubernetes clusters, in the left-hand panel, select
You can get a list of operations for a specific cluster:
-
In the management console
, open the folder with the cluster. -
Select Managed Service for Kubernetes.
-
Select the cluster.
-
Go to the
Operations panel for the selected cluster.You will see a list of operations with the selected cluster.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To get a list of operations for a Managed Service for Kubernetes cluster, run this command:
yc managed-kubernetes cluster list-operations <cluster_name_or_ID>
Result:
+----------------------+---------------------+----------------------+---------------------+--------+----------------+
| 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, operation information is displayed as text. To get more detailed information, specify the yaml or json output data format using the --format parameter:
yc managed-kubernetes cluster list-operations <cluster_name_or_ID> --format yaml
Result:
- 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
Use either the listOperations REST API method for the Cluster resource or the ClusterService/ListOperations gRPC API call.
Getting operation details
-
Get a list of operations for the Managed Service for Kubernetes cluster.
-
Copy the ID of the operation you need.
-
Get operation details:
CLIAPIIf you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the
yc config set folder-id <folder_ID>command. You can also set a different folder for any specific command using the--folder-nameor--folder-idparameter.Run this command:
yc operation get <operation_ID>Result:
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: REGULARUse the OperationService/Get gRPC API call.