Quick Start
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:
- Configure automatic
EventListenerexposure rules to exposeEventListenersexternally - Create
EventListenerand related resources - Get the automatically generated webhook address from
EventListenerstatus
TOC
Prerequisites
-
Environment Requirements
Kubernetesversion 1.21 or higherTekton Operatorinstalled- Ensure that
Tekton Triggersis installed and ready through the Operator
-
Required Tools
kubectlcommand line toolcurl(for testing triggers)
-
Permissions
- Requires cluster administrator privileges (for configuring
EventListenerautomatic exposure rules) - Requires namespace administrator privileges (for creating
EventListenerresources)
- Requires cluster administrator privileges (for configuring
Step 1: Configure Automatic EventListener Exposure Rules
About Automatic Exposure Feature
This is an Alauda platform enhancement (not part of standard Tekton Triggers) that simplifies EventListener external access configuration.
Three ways to expose EventListener:
-
Automatic Exposure (Alauda Enhancement) ⭐ Recommended for production
- Automatically creates and manages
Ingressresources - Centralized configuration via
TektonConfig - Webhook URLs automatically populated in
EventListenerstatus - Best for production environments with multiple
EventListeners
- Automatically creates and manages
-
Manual Ingress (Standard Tekton Approach)
- You manually create
Ingressresources for eachEventListener - More control but requires more maintenance
- Standard Kubernetes approach
- You manually create
-
Port-Forward or NodePort (Testing/Development) 🚀 Easiest to get started
- No
Ingressor DNS configuration needed - Great for local testing and learning
- See Skip to Simple Testing Setup if you want to start quickly
- No
If you're new to Triggers, you can skip this step and jump to the Simple Testing Setup section to get started with port-forward. Come back to configure automatic exposure later when you're ready for production deployment.
The EventListener automatic exposure feature automatically creates Ingress resources for your EventListeners based on export rules you configure. This eliminates the need to manually create and manage Ingress resources. You need to configure these rules first so that EventListeners can be accessed via external URLs. For detailed configuration instructions, refer to Configure EventListener automatic exposure rules.
Prerequisites
Before configuring the export rules, ensure you have the following prerequisites in place:
-
LoadBalancer or Gateway Configuration (Recommended for Production):
- For production environments, it's recommended to use a
LoadBalancerorGatewayto exposeEventListeners - The
LoadBalancer/Gatewayshould be configured and accessible - You should have the external domain name or IP address that will be used for webhooks
- For production environments, it's recommended to use a
-
Ingress Controller (If using Ingress):
- An
Ingresscontroller (such asNGINX,ALB, orTraefik) should be installed and running in your cluster - You should know the
IngressClassname that will be used - For more information on creating Ingresses, refer to Creating Ingresses.
- An
-
Domain and Certificate (For HTTPS):
- If using HTTPS, ensure you have a domain name configured
- TLS certificates should be prepared (either manually created or via
cert-manager)
Important Notes:
- The automatic exposure feature will automatically create
Ingressresources for you based on the export rules. You typically don't need to manually create or modifyIngressresources. - If you're using a
LoadBalancerwith a custom port, make sure to include the port in theexternalHostsfield (e.g.,https://webhooks.example.com:8443). - For development or testing environments, you can also use
NodePortinstead ofIngress/LoadBalancer. See the NodePort configuration example for details.
Configure Export Rules via TektonConfig
Create or update the TektonConfig resource to configure export rules. Create the file tektonconfig.yaml:
Understanding Automatic Exposure
The automatic exposure feature works by:
- Reading the export rules you configure in
TektonConfig - Automatically creating
Ingressresources forEventListenersthat match the rules - Populating the
EventListener'sstatus.addressesfield with webhook URLs that can be displayed in the UI - Eliminating the need to manually create and manage
Ingressresources for eachEventListener
This approach provides a centralized way to manage how EventListeners are exposed, making it easier to maintain consistent webhook URL patterns across your cluster.
Choose Ingress Configuration Method
The automatic exposure feature supports two methods for configuring Ingress to expose EventListeners externally. Choose the method that best fits your environment:
Alternative: NodePort Configuration
If you don't have a LoadBalancer or Ingress controller, or prefer a simpler setup for development/testing, you can use NodePort instead. See the NodePort configuration example for details. The automatic exposure feature is not required when using NodePort, as you'll access the EventListener directly via the node IP and NodePort.
Method 1: General Ingress Configuration (Recommended for Production)
This method is suitable for most Kubernetes environments. You need to:
-
Create an IngressClass (if not already exists): for more info please refer to Creating Ingresses.
-
Or use a LoadBalancer Service to get an external IP address for more info please refer to Configure a Load Balancer.
-
Configure the export rules based on your Ingress setup:
- If using IngressClass: Set
ingressClassto your IngressClass name (e.g.,nginx) - If using LoadBalancer: Get the external IP/domain from the LoadBalancer service and configure
hostandexternalHostsaccordingly
- If using IngressClass: Set
Example configuration for IngressClass:
DNS Configuration: When configuring the host field with a domain name, ensure that:
- DNS records are properly configured to resolve the domain to your Ingress controller's IP address
- For local testing, you can add the domain to
/etc/hosts(Linux/Mac) orC:\Windows\System32\drivers\etc\hosts(Windows) - The domain must be resolvable from the systems that will send webhooks (GitHub, GitLab, etc.)
Method 2: Quick Start for ACP Business Clusters
If you're using an ACP (Alauda Container Platform) business cluster, you can leverage the platform's built-in gateway for quick setup:
- Get your ACP platform access address (e.g.,
https://192.168.1.100) - Get your cluster name (e.g.,
test) - Configure the export rules as follows:
- Set
hostto empty (or use wildcard*) - Set
externalHoststo:<ACP Platform Access Address>/clusters-rewrite/<Cluster Name> - The final webhook URL will be:
<externalHost>/<urlPathPrefix>/<eventlistener-namespace>/<eventlistener-name>
- Set
Example configuration for ACP:
With this configuration, the webhook address will be:
ACP Configuration Formula:
- ACP Platform URL:
https://192.168.1.100 - Cluster Name:
test - URL Path Prefix:
/triggers(configurable) - External Host:
https://192.168.1.100/clusters-rewrite/test - Final Webhook URL:
https://192.168.1.100/clusters-rewrite/test/triggers/<eventlistener-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.
Apply TektonConfig
Verify Configuration
Wait a few moments for the Operator to sync the configuration, then verify:
The ConfigMap should contain your export rules configuration. (Note: The ConfigMap name trigger-wrapper-config is an internal technical name; you don't need to remember it, as you manage the configuration through TektonConfig.)
Step 2: Create Example Project
Create Namespace
About ServiceAccount for EventListener
For this quick start, we'll use the default ServiceAccount which is automatically created by the Tekton Triggers system. This ServiceAccount is named triggers-default-sa and has namespace-scoped permissions.
How it works:
- When
Tekton Triggersis installed, it automatically creates a defaultServiceAccountin each namespace - You can find it by running:
kubectl get sa -n tekton-triggers-demo -l triggers.tekton.dev/default-service-account - This
ServiceAccounthas permissions to createTaskRunsandPipelineRunswithin the same namespace - No manual configuration needed - just reference it by name:
triggers-default-sa
When you need a custom ServiceAccount:
- If you need to create resources in multiple namespaces (cross-namespace triggers)
- If you need additional permissions beyond the default scope
- See Setup EventListener for custom
ServiceAccountconfiguration
Step 3: Create Hello World TaskRun
Create Task
Create the file hello-task.yaml:
Create Trigger Template
Create the file trigger-template.yaml:
Create Trigger Binding
Create the file trigger-binding.yaml:
Create Event Listener
Create the file event-listener.yaml:
ServiceAccount Note: We're using the automatically created default ServiceAccount (by setting serviceAccountName to triggers-default-sa). This ServiceAccount is created by the Tekton Triggers system and has permissions to create TaskRuns/PipelineRuns within the same namespace. This is sufficient for this example since all resources are in the same namespace. The automatic exposure feature will automatically create an Ingress for this EventListener based on the export rules configured in Step 1.
Apply Configuration
Apply all created resources:
Alternative: Simple Testing Setup
If you skipped Step 1 (Automatic Exposure configuration) and want to test quickly, you can use port-forward or NodePort to access the EventListener without any Ingress or DNS setup.
Option A: Using Port-Forward (Simplest)
Wait for EventListener to be Ready
Forward Local Port to EventListener
Keep this terminal open. The EventListener is now accessible at http://localhost:8080.
Send Test Request via Port-Forward
Open a new terminal and run:
View Results
Option B: Using NodePort
For accessing EventListener from outside your local machine without Ingress:
Patch EventListener Service to NodePort
Get NodePort
Send Test Request via NodePort
When to use each method:
- Port-forward: Local testing, development, learning
- NodePort: Testing from other machines, development clusters
- Automatic Exposure (Ingress): Production deployments, external webhooks (GitHub, GitLab, etc.)
Step 4: Get Webhook Address and Test (Using Automatic Exposure)
Wait for EventListener to be Ready
Get Automatically Generated Webhook Address
The automatic exposure feature 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>/<eventlistener-namespace>/<eventlistener-name>
For example: https://webhooks.example.com/triggers/tekton-triggers-demo/hello-listener
If status.addresses is empty, check:
- The export rules you configured match your
EventListener's namespace - The automatic exposure controller is running and has processed the
EventListener - View controller logs:
kubectl logs -n tekton-pipelines -l app=tektoncd-enhancement-controller
Network 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.
Verify Webhook Domain Accessibility
Before sending test requests, verify that your webhook domain is accessible:
Important: Ensure that your webhook domain based on the LoadBalancer/Gateway is accessible from external systems. If you're configuring webhooks in GitHub, GitLab, or other external systems, they must be able to reach this URL. Check:
- DNS records are correctly configured
- LoadBalancer/Gateway is properly configured and accessible
- Firewall rules allow inbound traffic
- TLS certificates are valid (if using HTTPS)
Send Test Request to Webhook
View Results
Clean Up Resources
After testing, you can delete the created resources:
Next Steps
Now that you have successfully created and tested a basic Tekton Triggers example, you can:
- Explore concepts of Tekton Triggers
- Learn how to use Setup EventListeners for common setup instructions
- Configure EventListener automatic exposure rules for advanced exposure scenarios
- Setup and use Gitlab events to trigger pipelines
Frequently Asked Questions
-
EventListener Pod fails to start
- Check if the default
ServiceAccounthas sufficient namespace-scoped permissions - Verify the
EventListenerresource is correctly configured - View
EventListenerPod logs:kubectl logs -n tekton-triggers-demo -l app=el-hello-listener
- Check if the default
-
Webhook address (status.addresses) is empty
- Verify that the export rules you configured match your
EventListener's namespace - Check that the automatic exposure controller is running:
kubectl get pods -n tekton-pipelines -l app=tektoncd-enhancement-controller - View controller logs to see if there are any matching or configuration errors
- Ensure the namespace in
namespaceSelector.matchNamesmatches yourEventListenernamespace
- Verify that the export rules you configured match your
-
Trigger does not respond
- Verify the webhook URL is accessible (check
status.addresses) - Check if the request format is correct
- View the
EventListenerPod logs:kubectl logs -n tekton-triggers-demo -l app=el-hello-listener - Verify the
Ingressis correctly configured:kubectl get ingress -n tekton-triggers-demo
- Verify the webhook URL is accessible (check
-
TaskRun is not created
- Confirm that the
TriggerTemplateconfiguration is correct - Check the parameter mapping in
TriggerBinding - View the error logs of the
EventListenerPod
- Confirm that the