This topic describes how to collect the log of a Job to Log Service.
Prerequisites
- A serverless Kubernetes (ASK) cluster is created. For more information, see Create an ASK cluster.
- A virtual node is deployed in the cluster. For more information, see Deploy the virtual node controller and use it to create Elastic Container Instance-based pods.
- An Apsara File Storage NAS (NAS) file system is created and a mount target is added. For more information, see Create a NAS file system and Manage mount targets.
Procedure
If Elastic Compute Service (ECS) instances are used in a cluster, DaemonSets can be used to collect the standard output of a Job. If elastic container instances are used in a cluster, you cannot use DaemonSets to collect log data. After a Job is complete, the pods created by the Job immediately exit. However, the log of the Job may not be collected. To resolve this problem, you can use the following method:
Mount a NAS file system to the Job and store the log to the NAS file system. Then, mount the NAS file system to a pod that is used to import the log to Log Service.