ACK clusters support triggers. When a trigger link is accessed, the workload automatically restarts. This topic describes how to use triggers.
Introduction to triggers
By creating triggers, you can automatically restart specified workloads in specific scenarios to improve operational efficiency. Examples:
Scenario | Trigger Action | Description |
Configuration update triggers restart | Update configuration and restart related pods | Monitor ConfigMap changes. When the configuration changes, you can restart the application by calling a trigger. |
External trigger signal initiates deployment | Automatically deploy new application versions | When a new image is pushed to the image repository, automatically trigger application deployment through a webhook to ensure the application is updated after code changes. |
Prerequisites
A workload is created. You can use this workload to create and test a trigger. For more information, see Create a stateless workload Deployment. You do not need to create a Service.
Procedure
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, find the cluster you want to manage and click its name. In the left navigation pane, choose .
On the Deployments page, find Nginx, and click Details in the Actions column.
On the Nginx details page, click the Triggers tab, and then click Create Trigger.
In the Create Trigger dialog box, set Action to Redeploy, and then click Confirm.
NoteCurrently, Action supports only the redeploy feature.
After the trigger is created, a trigger link appears in the trigger column on the Nginx details page.

Copy the trigger link and access it in your browser. The page returns a message that contains information such as the status code and request ID.

Return to the Nginx details page and click the Pods tab to observe the new pod that appears. After the new pod is deployed, the Nginx workload deletes the old pod and keeps only the new pod.
Use triggers through other methods
Standard HTTP GET or POST requests can trigger the action. For example, you can run the curl https://cs.console.alibabacloud.com/hook/trigger?token=xxxxxxx command to trigger the action.
In some Shell versions, the ? character may be recognized as a wildcard, which causes the curl command to fail. You can solve this problem by adding quotation marks around the link, such as curl "https://cs.console.alibabacloud.com/hook/trigger?token=xxxxxxx".
References
You can also manage triggers through OpenAPI. For more information, see: