Setup EventListener
For an in-depth understanding of EventListener concepts, architecture, and principles, please refer to the In-Depth Understanding of EventListener document.
TOC
OverviewKey FeaturesConfiguration InstructionsBasic StructureMain Field Descriptionsspec.resources.kubernetesResourcespec.triggersSecurity ConfigurationsPermission GuidelinesUser GuideScaleNetwork ConfigurationSmall Scale + HTTPS + ALB Ingress Configuration ExamplePrerequisitesConfiguration ExampleBest PracticesFrequently Asked QuestionsReference LinksOverview
EventListener is a core resource in Tekton Triggers, responsible for receiving and processing external events (such as Webhooks). When an external system triggers an event, the EventListener creates Kubernetes resources (such as PipelineRun) based on the configured triggers.
Key Features
EventListener has the following key features:
- Event Listening: Provides an HTTP endpoint to receive Webhook events from external systems
- Event Filtering: Validates and filters received events using interceptors
- Resource Creation: Automatically creates Kubernetes resources based on trigger definitions
- Extensibility: Supports custom interceptors and various event sources
- Security: Built-in multiple security mechanisms such as Webhook validation
Configuration Instructions
Basic Structure
Main Field Descriptions
spec.resources.kubernetesResource
Used to configure the Kubernetes resources for the EventListener:
serviceType: Service type (NodePort/ClusterIP/LoadBalancer)servicePort: Service portspec: Pod template configuration
spec.triggers
Defines a set of trigger configurations:
name: Trigger nameinterceptors: List of interceptor configurationsbindings: Trigger binding configurationstemplate: Trigger template configurations
Security Configurations
EventListener supports multiple security configurations:
- ServiceAccount: Specify running permissions through
spec.serviceAccountName. Ensure that the specified ServiceAccount is configured with the corresponding permissions. - Interceptor Validation: Use CEL interceptors for event validation.
- TLS: Supports configuring HTTPS certificates.
Permission Guidelines
To trigger pipeline and tasks properly, the ServiceAccount used by EventListener needs the following permissions:
Referable ClusterRole:
User Guide
Deploying the EventListener needs to be planned according to the scale and the actual network situation of the environment, as described below on how to configure differently based on planning:
Scale
In different planning scenarios, different configurations can be used to meet varying requirements.
Network Configuration
Depending on the priority of the environment and the available network resources, different network configurations can be chosen.
Small Scale + HTTPS + ALB Ingress Configuration Example
Prerequisites
- The domain name is configured correctly, and corresponding certificates are in place.
- ALB is deployed and configured properly.
Configuration Example
Create Namespace (Optional)
Ensure there is a Namespace for easy management of EventListener and other permissions; here we use tekton-webhooks as an example.
Create EventListener
Save the following YAML as eventlistener.yaml.
Create ClusterRole
The following YAML is for eventlistener-role.yaml.
Create ServiceAccount and Set Permissions
Create a binding using the ClusterRole and ServiceAccount above.
Create Ingress and TLS Secrets
You need to set the <host> with the corresponding domain name and certificate information.
Validate Webhook Configuration
You can test whether the configuration is normal using the following curl.
Best Practices
-
Resource Limits:
- Set appropriate resource requests and limits for EventListener Pods.
- Adjust the number of replicas based on actual load.
-
Security:
- Use HTTPS and Webhook Secrets.
- Configure the least privilege ServiceAccount.
- Validate all incoming events using interceptors.
-
Availability:
- Expose services using LoadBalancer or Ingress.
- Configure appropriate health checks.
- Implement high-availability deployments.
-
Monitoring:
- Monitor EventListener logs.
- Set appropriate alert mechanisms.
- Track event processing performance.
Frequently Asked Questions
-
Events Not Triggering Pipeline
- Check interceptor configurations.
- Validate Webhook configuration.
- Review EventListener logs.
-
Permission Issues
- Confirm ServiceAccount permissions.
- Check Role and RoleBinding.
- Verify namespace access permissions.
-
Performance Issues
- Adjust resource limits.
- Optimize interceptor configurations.
- Consider horizontal scaling.