Skip to main content
Tekton emits events to notify external systems about TaskRun and PipelineRun execution status. Two event types are supported: Kubernetes events and CloudEvents.

Kubernetes Events

Tekton controllers emit standard Kubernetes events that can be retrieved using kubectl describe.

TaskRun Events

TaskRuns emit events for the following reasons:
event
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
event
Emitted when all steps in the TaskRun execute successfully, including Tekton-injected post-steps.
event
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:
event
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.
event
Emitted when the PipelineRun passes validation and begins execution.
event
Emitted when all Tasks reachable via the DAG execute successfully.
event
Emitted when:
  • A Task fails
  • PipelineRun times out
  • PipelineRun is cancelled
  • Validation fails (PipelineRun cannot execute)

Viewing Kubernetes Events

View events for a TaskRun:
View events for a PipelineRun:
View all events in a namespace:

CloudEvents

When configured with a sink, Tekton emits CloudEvents for run lifecycle changes.

CloudEvents Configuration

Configure CloudEvents in the config-events ConfigMap:
string
default:"tektonv1"
Comma-separated list of event formats. Currently only tektonv1 is supported.
An empty string is not valid. To disable events, omit the sink.
string
Event sink URL for TaskRun, PipelineRun, and CustomRun events.
This setting supersedes default-cloud-events-sink from the config-defaults ConfigMap.

Legacy Configuration

The deprecated config-defaults configuration is still supported:
The default-cloud-events-sink option in config-defaults is deprecated and will be removed. Use the config-events ConfigMap instead.

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:

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 Succeeded condition 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

  1. Verify sink is configured:
  2. Check controller logs:
  3. Test sink connectivity from cluster:

Duplicate Events

Duplicate events can occur due to:
  • Controller restarts (CustomRun cache reset)
  • Network retry logic
  • Event delivery retries
Implement idempotency in your event handler using the 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
Implement proper error handling and consider using a message queue for critical events.

Best Practices

  1. Use idempotent event handlers - Events may be delivered more than once
  2. Handle all event types - Don’t assume only specific types will be received
  3. Implement proper error handling - Return appropriate HTTP status codes
  4. Use async processing - Respond quickly (< 30s) to avoid timeouts
  5. Log event IDs - Use Ce-Id for debugging and deduplication
  6. Monitor sink availability - High availability sinks prevent event loss
  7. Consider event ordering - Don’t rely on events arriving in chronological order