All Products
Search
Document Center

Container Service for Kubernetes:Workflow persistence

Last Updated:Feb 27, 2026

Argo Workflows periodically deletes workflow-related resources from workflow clusters. To retain workflow history for analysis and tracing, persist workflow data to a database. After persistence is configured, workflow logs remain accessible even after workflows or their pods are deleted. This topic uses ApsaraDB RDS for MySQL as an example to describe how to persist workflow data to a database.

Prerequisites

Before you begin, make sure that you have:

  • An ACK Distributed Cloud Container Platform for Kubernetes workflow cluster

  • An ApsaraDB RDS for MySQL instance. For more information, see Create an ApsaraDB RDS for MySQL instance

  • A database and an account for the ApsaraDB RDS for MySQL instance. For more information, see Create accounts and databases

  • The ApsaraDB RDS for MySQL instance in the same virtual private cloud (VPC) as the workflow cluster

  • The VPC CIDR block added to the whitelist of the ApsaraDB RDS for MySQL instance

Create a Secret for database credentials

Create a Secret named argo-mysql-config in the workflow cluster to store the database username and password.

Run the following command:

kubectl create secret generic argo-mysql-config \
  --namespace=default \
  --from-literal=username=<database-username> \
  --from-literal=password=<database-password>

Replace <database-username> and <database-password> with the credentials of the database account created in the prerequisites.

The command creates a Secret equivalent to the following YAML manifest:

apiVersion: v1
kind: Secret
metadata:
  name: argo-mysql-config   # Secret name referenced by the persistence configuration
  namespace: default
type: Opaque
stringData:
  username: <database-username>   # Replace with your database username
  password: <database-password>   # Replace with your database password

Configure persistence settings

Add the persistence block to the workflow-controller-configmap ConfigMap.

  • The workflow-controller-configmap ConfigMap is stored in the namespace that uses the cluster ID as its name.

  • Set host to the endpoint of the ApsaraDB RDS for MySQL instance.

  • Set database to the name of the database created in the prerequisites.

  • Set archive to true to enable workflow archiving.

  • archiveTTL specifies how long archived workflows are retained. For example, 30d retains workflows for 30 days. Valid values are not limited to a fixed set.

The following table describes the key parameters:

ParameterDescriptionExample value
connectionPool.maxIdleConnsMaximum number of idle connections in the pool100
connectionPool.maxOpenConnsMaximum number of open connections. 0 means unlimited.0
connectionPool.connMaxLifetimeMaximum connection lifetime. 0s means no limit.0s
archiveTTLRetention period for archived workflows30d
archiveWhether to enable workflow archivingtrue
mysql.hostApsaraDB RDS for MySQL endpointrm-xxx.mysql.cn-beijing.rds.aliyuncs.com
mysql.portMySQL port3306
mysql.databaseDatabase nameargo-workflow
mysql.tableNameTable name for workflow dataargo_workflows
mysql.userNameSecret.nameSecret name that stores the database usernameargo-mysql-config
mysql.userNameSecret.keyKey in the Secret for the usernameusername
mysql.passwordSecret.nameSecret name that stores the database passwordargo-mysql-config
mysql.passwordSecret.keyKey in the Secret for the passwordpassword
persistence: |
    connectionPool:
      maxIdleConns: 100
      maxOpenConns: 0
      connMaxLifetime: 0s
    archiveTTL: 30d
    archive: true
    mysql:
      host: rm-xxx.mysql.cn-beijing.rds.aliyuncs.com
      port: 3306
      database: argo-workflow
      tableName: argo_workflows
      userNameSecret:
        name: argo-mysql-config
        key: username
      passwordSecret:
        name: argo-mysql-config
        key: password

What to do next

After workflows are persisted, use the Argo CLI to view workflow logs even after the workflows are deleted. For more information, see Configure Log Service.