All Products
Search
Document Center

Container Service for Kubernetes:Configure Simple Log Service

Last Updated:Mar 26, 2026

By default, Kubernetes does not retain pod logs after a pod is deleted. If you delete pods to reclaim cluster resources, you lose the log history for completed workflows. Simple Log Service integration solves this: it collects pod logs as they run and stores them durably, so you can query logs for any workflow even after the pod is gone.

How it works

When you create a workflow cluster, the system automatically creates a Simple Log Service project named k8s-log-<clusterid>. All pod logs from workflows in that cluster are collected into a Logstore named workflow-logstore.

Once log collection is enabled, you can view logs using the Argo CLI, Argo Server, or Argo UI — regardless of whether the pod is still running.

Limitations

  • If oss-artifact-repository is enabled and archiveLogs: true is set for a workflow cluster, Simple Log Service does not collect pod logs. Logs are routed to oss-artifact-repository instead. To use Simple Log Service in this case, remove the archiveLogs: true setting.

  • After log collection is enabled, you can view workflow logs at any time before the workflow is deleted, regardless of whether the pod has been deleted.

  • If a workflow is persisted to a database, you can download its logs as a ZIP file or view them in the Simple Log Service console even after the workflow is deleted. For details, see Persist workflows.

Enable Simple Log Service

If the k8s-log-<clusterid> project was not created automatically when you created the workflow cluster, create it manually before proceeding. See Create a Simple Log Service project.

Choose one of the following methods:

Method Best for
Alibaba Cloud Argo CLI Quick setup with a single interactive command
AliyunLogConfig GitOps workflows or declarative configuration management

Enable Simple Log Service by using the Alibaba Cloud Argo CLI

The Alibaba Cloud Argo CLI is fully compatible with the open-source Argo CLI and extends it with log collection support for deleted pods.

Prerequisites

Steps

Run the following command to configure Simple Log Service. When prompted, enter the number of days to retain logs (default: 7 days).

argo config sls
Please input log retention days. Default is 7 days.
10

Expected output:

Start to config SLS for your cluster.
Created AliyunLogConfig CR workflow-sls-config in default namespace.
Created SLS logstore workflow-logstore in SLS project k8s-log-<clusterid>, log retention days is 10 days

The output confirms that Simple Log Service is configured. All workflow logs in the cluster are collected to the workflow-logstore Logstore in the k8s-log-<clusterid> project.

Enable Simple Log Service by creating an AliyunLogConfig

Apply the following YAML manifest to create an AliyunLogConfig custom resource. The Log Service controller automatically creates the k8s-log-<clusterid> project and the workflow-logstore Logstore.

cat << EOF | kubectl apply -f -
apiVersion: log.alibabacloud.com/v1alpha1
kind: AliyunLogConfig
metadata:
  name: workflow-sls-config
  namespace: default
spec:
  lifeCycle: 5           # Log retention period in days
  logstore: workflow-logstore
  logtailConfig:
    configName: workflow-sls-config
    inputType: plugin    # Use the plugin-based input method
    inputDetail:
      plugin:
        inputs:
        - type: service_docker_stdout  # Collect container stdout and stderr
          detail:
            Stdout: true
            Stderr: true
EOF

Verify log collection

After enabling Simple Log Service, confirm that logs are being collected:

  1. Log on to the Simple Log Service console.

  2. Find the k8s-log-<clusterid> project.

  3. Click workflow-logstore and check that log entries appear.

If no logs appear, run the following command to check whether the AliyunLogConfig custom resource was created successfully:

kubectl get aliyunlogconfigs -n default

The output should include workflow-sls-config with no error status. If the resource is missing or shows an error, re-run the enable steps or check that your RAM user has the required permissions.

Access logs by using the Argo CLI

The Argo CLI provides two ways to view workflow logs. The direct method (using the --sls flag) is recommended because it does not require Argo Server setup.

You can run kubectl logs <pod-name> to view the logs of an existing pod, but by default this command returns up to 2,000 rows of log data. To view more log data or to view logs for a deleted pod, use one of the following methods.

Use the Argo CLI directly (recommended)

Prerequisites

  • Downloaded and installed Alibaba Cloud Argo CLI 3.4.12. For details, see Alibaba Cloud Argo CLI.

  • If you use a RAM user, the AliyunLogReadOnlyAccess policy is attached to the RAM user.

Steps

  1. Grant the Argo CLI access to your cluster:

    argo config init  # Follow the prompts to enter your AccessKey ID and AccessKey secret.
  2. Query logs:

    # View logs for a specific pod
    argo logs <workflow-name> <pod-name> --sls
    
    # Download all logs for a workflow as a ZIP file
    argo logs <workflow-name> --sls

Use Argo Server

If you prefer to access Simple Log Service through Argo Server, set the following environment variables first.

To query logs collected by Simple Log Service via Argo Server, you must specify <pod-name>. To access workflows or pods in a different namespace, obtain the KUBE_TOKEN for that namespace.
  1. Set the required environment variables:

    export ARGO_SERVER=argo.<cluster id>.<region>.alicontainer.com:2746
    export KUBE_TOKEN=$(kubectl create token default -n default --duration 24h)
    export ARGO_TOKEN="Bearer $KUBE_TOKEN"
    export ARGO_INSECURE_SKIP_VERIFY=true
  2. Query the logs for a specific pod:

    argo logs <workflow-name> <pod-name>

View logs for workflows persisted to databases

If a workflow is persisted to a database, you can download its logs after the workflow is deleted.

  1. Grant the Argo CLI access to your cluster:

    argo config init  # Follow the prompts to enter your AccessKey ID and AccessKey secret.
  2. Get the UID of the archived workflow:

    argo archive list

    Expected output:

    NAMESPACE   NAME                   STATUS      AGE   DURATION   PRIORITY   MESSAGE   P/R/C   PARAMETERS   UID
    default     hello-world-l6c2r      Succeeded   3d    1m         0                    0/0/0                179eaef0-fde3-496f-946d-549e8f******
  3. Download the workflow logs using the UID:

    argo archive logs 179eaef0-fde3-496f-946d-549e8f******

    The logs are saved as <workflow-name>.zip in the current directory.

Use the Argo UI to view logs

The Argo UI displays workflow pod logs directly. If a pod has been deleted, the logs collected by Simple Log Service are shown in place of the live pod output.

访问日志

Disable Simple Log Service

  1. Delete the AliyunLogConfig custom resource:

    kubectl delete aliyunlogconfigs.log.alibabacloud.com workflow-sls-config -n default
  2. Log on to the Simple Log Service console and delete the workflow-logstore Logstore.

What's next

  • Persist workflows — Store workflow state in a database to access logs and results after the workflow is deleted.

  • Alibaba Cloud Argo CLI — Download and configure the CLI for full log access capabilities.