A trigger is an API provided by the Container Service for simple and fast redeployment and resource scaling.
As standard APIs require security, strict authentication is needed. However, in scenarios where an API is integrated with a third-party system (for example, Jenkins or other continuous integration and deployment (CI/CD) system), the required permission is limited, for example, messaging only. Therefore, for security and convenience considerations, APIs that have partial authentication policies and can be flexibly called are widely applied in scenarios requiring continuous integration and delivery.
Currently, the Container Service provides redeployment trigger and scaling trigger.
You can integrate your APIs with your monitoring system, and redeploy your applications when the system has exceptions; you can also integrate your APIs with Hub container, so that the container can be automatically redeployed using the new image after the new image is constructed.
You can call the scaling trigger to realize container scaling.
Log on to the Container Service console
Click Applications in the left-side navigation pane.
Select the target cluster and click the name of the application.
Click Create Trigger.
Select Redeploy or Scaling in Action and click Confirm.
When you have write permission on the image used by the application, you can select Associated with image update. Then, the container can be automatically redeployed using the new image after the new image is constructed.
Select the service in the Service drop-down list.
Note: To use the scaling trigger, you need to upgrade the cluster Agent to the latest version.
The trigger IP addresses generated are the API IP addresses.
You can call the trigger through a third-party system or a GET or POST request. For example, you can run the CURL command to call the trigger.
Call the redeployment trigger:
Call the scaling trigger:
Note: When calling the scaling trigger, you need to add the following parameters in the URL:
|type||Yes||The type of scaling||Reduce: scale_in; expand: scale_out|
|step||Yes||The number of containers to be removed or added||Positive integer: 1~100|
For example, calling the following trigger will add 5 containers to the service.