This guide will help you get started with Tekton Triggers by creating a simple "Hello World" trigger scenario to demonstrate its basic functionality. The guide follows these steps:
Environment Requirements
Required Tools
Permissions
The trigger-wrapper automatically exposes EventListeners externally based on export rules. You need to configure these rules first so that EventListeners can be accessed via external URLs. For detailed configuration instructions, refer to Configure trigger-wrapper export rules.
Create or update the TektonConfig resource to configure export rules. Create the file tektonconfig.yaml:
The trigger-wrapper supports two methods for configuring Ingress to expose EventListeners externally. Choose the method that best fits your environment:
This method is suitable for most Kubernetes environments. You need to:
Create an IngressClass (if not already exists): for more info please refer to .
Or use a LoadBalancer Service to get an external IP address for more info please refer to .
Configure the export rules based on your Ingress setup:
ingressClass to your IngressClass name (e.g., nginx)host and externalHosts accordinglyExample configuration for IngressClass:
If you're using an ACP (Alauda Container Platform) business cluster, you can leverage the platform's built-in gateway for quick setup:
https://192.168.1.100)test)host to empty (or use wildcard *)externalHosts to: <ACP Platform Access Address>/clusters-rewrite/<Cluster Name><externalHost>/<urlPathPrefix>/<namespace>/<eventlistener-name>Example configuration for ACP:
With this configuration, the webhook address will be:
ACP Configuration Formula:
https://192.168.1.100test/triggers (configurable)https://192.168.1.100/clusters-rewrite/testhttps://192.168.1.100/clusters-rewrite/test/triggers/<namespace>/<eventlistener-name>Example: If ACP platform address is https://192.168.1.100, cluster name is test, and urlPathPrefix is /triggers, then the access address is https://192.168.1.100/clusters-rewrite/test/triggers.
Important: Replace the placeholder values (webhooks.example.com, nginx, etc.) with your actual domain name, ingress class, and external host URL. If you don't have a domain configured, you can use an empty host field and configure externalHosts with your actual accessible URL.
Wait a few moments for the Operator to sync the configuration, then verify:
The ConfigMap should contain your export rules configuration.
For this quick start, we'll use the default ServiceAccount which has namespace-scoped permissions. This is sufficient since we're only handling triggers within the same namespace. If you need to handle triggers across multiple namespaces, refer to Setup EventListener for configuring a custom ServiceAccount with cluster-scoped permissions.
Create the file hello-task.yaml:
Create the file trigger-template.yaml:
Create the file trigger-binding.yaml:
Create the file event-listener.yaml:
ServiceAccount Note: We're using the default ServiceAccount here (by setting serviceAccountName to triggers-default-sa). This is sufficient for this example since all resources are in the same namespace. The trigger-wrapper will automatically expose this EventListener based on the export rules configured in Step 1.
Apply all created resources:
The trigger-wrapper automatically generates external webhook addresses based on the export rules configured in Step 1. These addresses are populated in the EventListener's status.addresses field:
Address Format: The webhook address follows the pattern: <externalHost>/<urlPathPrefix>/<namespace>/<eventlistener-name>
For example: https://webhooks.example.com/triggers/tekton-triggers-demo/hello-listener
If status.addresses is empty, check:
kubectl logs -n tekton-pipelines -l app=tektoncd-enhancement-controllerNetwork Access: Ensure your external host URL is accessible from where you're testing. If you're testing within the cluster, you may need to use port-forward or access the internal service address instead.
After testing, you can delete the created resources:
Now that you have successfully created and tested a basic Tekton Triggers example, you can:
EventListener Pod fails to start
kubectl logs -n tekton-triggers-demo -l app=el-hello-listenerWebhook address (status.addresses) is empty
kubectl get pods -n tekton-pipelines -l app=tektoncd-enhancement-controllernamespaceSelector.matchNames matches your EventListener namespaceTrigger does not respond
status.addresses)kubectl logs -n tekton-triggers-demo -l app=el-hello-listenerkubectl get ingress -n tekton-triggers-demoTaskRun is not created