Overview
When an error occurs in a Container Service for Kubernetes (ACK) cluster or a node in the ACK cluster, you must collect diagnostics data from nodes in the ACK cluster for data analysis. This document describes how to collect diagnostics data from nodes in an ACK cluster.
Details
When an error occurs in an ACK cluster, you must collect diagnostics data from a master node in the ACK cluster. When an error occurs in a worker node, you must collect diagnostics data from a master node and the worker node in the ACK cluster. The following method is applicable to both master and worker nodes. In this example, a master node is used.
Note:
- Assume that your worker node runs Windows. For more information about how to collect diagnostics data, see the More information section in this document.
- A node that runs Windows can act only as a worker node.
- Log on to a master node in an ACK cluster. For more information, see Use kubectl to connect to an ACK cluster.
- Run the following command to download the diagnostics script:
curl -o /usr/local/bin/diagnose_k8s.sh http://aliacs-k8s-[$Region_ID].oss-cn-[$Region_ID].aliyuncs.com/public/diagnose/diagnose_k8s.sh
Note: Specify the ID of the region where the cluster resides, such as cn-hangzhou.
- Run the following command to grant the execution permissions to the diagnostics script:
chmod u+x /usr/local/bin/diagnose_k8s.sh
- Run the following command to go to the specified directory:
cd /usr/local/bin
- Run the following command to run the diagnostics script:
diagnose_k8s.sh
The following output is returned. Each time you run the diagnostics script, a different name is used for the diagnostics report generated. In this example, diagnose_1514939155.tar.gz is used as the diagnostics report name. The name is subject to the actual conditions.
...... + echo 'please get diagnose_1514939155.tar.gz for diagnostics' please get diagnose_1514939155.tar.gz for diagnostics + echo '请上传 diagnose_1514939155.tar.gz' 请上传 diagnose_1514939155.tar.gz
- Run the following command to view the diagnostics report:
ls -ltr | grep diagnose_1514939155.tar.gz
Note: Replace diagnose_1514939155.tar.gz with the name of the diagnostics report generated in actual scenarios.
More information
- Log on to the worker node in which an error occurs. For more information, see Use kubectl to connect to an ACK cluster.
- Choose Start > Run. In the Run dialog box, enter cmd and click OK to open Command Prompt.
- Run the following command to start PowerShell:
powershell
- Run the following command to download and run the diagnostics script:
Invoke-WebRequest -UseBasicParsing -Uri http://aliacs-k8s-[$Region_ID].oss-cn-[$Region_ID].aliyuncs.com/public/pkg/windows/diagnose/diagnose.ps1 | Invoke-Expression
The following output is returned, which indicates that the diagnostics data is collected.INFO: Compressing diagnosis clues ...
INFO: ...done
INFO: Please get diagnoses_1514939155.zip for diagnosticsNote: Save the diagnoses_1514939155.zip file in the directory where the diagnostics script resides.
Applicable scope
ACK