All Products
Search
Document Center

Container Service for Kubernetes:Collect the diagnostic logs of nodes

Last Updated:Dec 15, 2023

You can diagnose one or more nodes at a time in the Container Service for Kubernetes (ACK) console and collect the diagnostic logs. This topic describes how to collect diagnostic logs of nodes with simple steps.

Prerequisites

Select nodes to diagnose

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.

  3. Optional: Authorize the cluster to collect logs to OSS.

    Before you can upload diagnostic logs from nodes to an OSS bucket, you must grant the nodes the write permissions on the specified directory in OSS.

    1. On the details page of the cluster, click the Cluster Resources tab. On the Cluster Resources tab, click the hyperlink next to Worker RAM Role.

    2. On the Permissions tab, click the policy whose name is prefixed with k8sWorkerRole.

    3. On the Policy Document tab, click Modify Policy Document.

    4. On the Visual Editor Beta or JSON tab, add the following content to the policy content, and specify the bucket name and directory. After you modify the content, click Next to edit policy information. Then, click OK.

      {
          "Action": [
              "oss:GetBucket",
              "oss:PutObject",
              "oss:GetObject"
          ],
          "Resource": [
              "acs:oss:*:*:<the OSS bucket name>/<the directory used to store diagnostic logs>/*"
          ],
          "Effect": "Allow"
      },
      {
          "Action": [
              "oss:GetBucketInfo"
          ],
          "Resource": [
              "acs:oss:*:*:<the OSS bucket name>"
          ],
          "Effect": "Allow"
      }
  4. In the left-side navigation pane of the details page, choose Nodes > Nodes.

  5. On the Nodes page, select one or more nodes and click Node Diagnosis.

  6. In the Node Diagnosis dialog box, perform the following operations:

    You can choose whether to upload diagnostic logs to OSS. You can view the diagnostic logs regardless of whether the logs are uploaded to OSS.

    Scenario 1: Upload diagnostic logs to OSS

    You can upload the diagnostic logs to an OSS bucket. Before you perform the following steps, you must authorize the worker Resource Access Management (RAM) role of the cluster to collect logs to OSS. For more information, see Step 3.

    1. Enter the name and directory of the OSS bucket.

      For example, if you want to upload the diagnostic logs to the /acs/diagnose directory in myBucket, enter myBucket/acs/diagnose.

    2. Select or clear Share Diagnosis Logs.

      If you select the check box, the system generates a temporary link for you to download the diagnostic logs. You can also share the link with the ACK support team to request technical support.

    3. Click OK.

      After the preceding steps are completed, you can obtain the task ID of Cloud Assistant in the console. Then, you can use the task ID to find and view the logs of diagnostic script executions in the Elastic Compute Service (ECS) Cloud Assistant console.

    4. In the Node Diagnosis dialog box, click Go to Cloud Assistant to View Diagnosis Script Execution Logs.

    5. On the Cloud Assistant page, choose Maintenance & Monitoring > ECS Cloud Assistant. Click the Command Execution Result to view relevant diagnostic logs.

    6. Find the task ID and click View in the Actions column.

      You can go to the OSS console to view the diagnostic logs that are collected in the specified directory.

    Scenario 2: Do not upload diagnostic logs to OSS

    If you clear Upload to OSS, you do not need to grant the nodes the write permissions on the specified directory in OSS. You can log on to the ECS console and choose Maintenance & Monitoring > ECS Cloud Assistant > Command Execution Result to view relevant diagnostic logs.