Kubernetes Events
Tekton controllers emit standard Kubernetes events that can be retrieved usingkubectl describe.
TaskRun Events
TaskRuns emit events for the following reasons:Emitted when the TaskRun is first picked by the reconciler from the work queue (after successful webhook validation).Does not indicate Step execution. Steps execute only after:
- Task and resource validation succeeds
- Associated Conditions checks succeed
- Pod scheduling succeeds
Emitted when all steps in the TaskRun execute successfully, including Tekton-injected post-steps.
Emitted when:
- A Step fails
- TaskRun times out
- TaskRun is cancelled
- Validation fails (TaskRun cannot execute)
PipelineRun Events
PipelineRuns emit events for the following reasons:Emitted when the PipelineRun is first picked by the reconciler from the work queue (after successful webhook validation).Does not indicate Step execution. Steps execute after validation succeeds for the Pipeline and all associated Tasks and Resources.
Emitted when the PipelineRun passes validation and begins execution.
Emitted when all Tasks reachable via the DAG execute successfully.
Emitted when:
- A Task fails
- PipelineRun times out
- PipelineRun is cancelled
- Validation fails (PipelineRun cannot execute)
Viewing Kubernetes Events
View events for a TaskRun:CloudEvents
When configured with a sink, Tekton emits CloudEvents for run lifecycle changes.CloudEvents Configuration
Configure CloudEvents in theconfig-events ConfigMap:
Comma-separated list of event formats. Currently only
tektonv1 is supported.An empty string is not valid. To disable events, omit the sink.
Event sink URL for TaskRun, PipelineRun, and CustomRun events.
This setting supersedes
default-cloud-events-sink from the config-defaults ConfigMap.Legacy Configuration
The deprecatedconfig-defaults configuration is still supported:
CustomRun Events
CloudEvents for CustomRuns require additional configuration:CustomRun CloudEvents use an ephemeral cache to avoid duplicates. Controller restarts reset the cache and may result in duplicate events.
CloudEvent Types
Tekton emits the following CloudEvent types:| Resource | Event | Event Type |
|---|---|---|
| TaskRun | Started | dev.tekton.event.taskrun.started.v1 |
| TaskRun | Running | dev.tekton.event.taskrun.running.v1 |
| TaskRun | Condition Change while Running | dev.tekton.event.taskrun.unknown.v1 |
| TaskRun | Succeeded | dev.tekton.event.taskrun.successful.v1 |
| TaskRun | Failed | dev.tekton.event.taskrun.failed.v1 |
| PipelineRun | Started | dev.tekton.event.pipelinerun.started.v1 |
| PipelineRun | Running | dev.tekton.event.pipelinerun.running.v1 |
| PipelineRun | Condition Change while Running | dev.tekton.event.pipelinerun.unknown.v1 |
| PipelineRun | Succeeded | dev.tekton.event.pipelinerun.successful.v1 |
| PipelineRun | Failed | dev.tekton.event.pipelinerun.failed.v1 |
| Run | Started | dev.tekton.event.run.started.v1 |
| Run | Running | dev.tekton.event.run.running.v1 |
| Run | Succeeded | dev.tekton.event.run.successful.v1 |
| Run | Failed | dev.tekton.event.run.failed.v1 |
CloudEvent Format
CloudEvents follow the CloudEvents specification.HTTP Headers
Context fields are included as HTTP headers:Payload
The payload is JSON with a single root key (taskRun or pipelineRun) containing the complete resource spec and status:
Event Delivery
CloudEvents are sent in a parallel routine to allow retries without blocking the reconciler:- Events are sent when the
Succeededcondition changes (state, reason, or message) - Retries use exponential back-off strategy
- Events are not guaranteed to arrive in order due to retries
Event Sink Implementation Examples
Simple HTTP Sink
Knative Event Sink
Filtering Events
To process only specific event types in your sink:Troubleshooting
No Events Received
-
Verify sink is configured:
-
Check controller logs:
-
Test sink connectivity from cluster:
Duplicate Events
Duplicate events can occur due to:- Controller restarts (CustomRun cache reset)
- Network retry logic
- Event delivery retries
Ce-Id header.
Missing Events
Events may be missed if:- Sink is unavailable during event emission
- Sink returns non-2xx status codes
- Network issues prevent delivery
Best Practices
- Use idempotent event handlers - Events may be delivered more than once
- Handle all event types - Don’t assume only specific types will be received
- Implement proper error handling - Return appropriate HTTP status codes
- Use async processing - Respond quickly (< 30s) to avoid timeouts
- Log event IDs - Use
Ce-Idfor debugging and deduplication - Monitor sink availability - High availability sinks prevent event loss
- Consider event ordering - Don’t rely on events arriving in chronological order