Knative: Operator’s Handbook

Trigger

A Trigger allows a subscriber to register interest in events from a Broker. It can also be used to filter events before they reach to the Service.

apiVersion: eventing.knative.dev/v1alpha1
kind: Trigger
metadata:
  name: trigger-event-display
spec:
 broker: default
 subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: event-display

If the broker: is not specified, it reverts to default Broker.

Create the Trigger in the namespace needed (in this case default namespace):

$ kubectl apply -f trigger.yaml
trigger.eventing.knative.dev/trigger-event-display created

You can inspect the Broker and Subscriber the Trigger connects to:

$ kubectl get trigger
NAME                    READY   BROKER    SUBSCRIBER_URI
trigger-event-display   True    default http://event-display.default.svc.cluster.local/

A Trigger can have no filters (as shown above) and the subscriber will be delivered all events that flow on the Broker. For Trigger with filtering, see Event filtering.