Knative: Operator’s Handbook

Subscription

A Subscription connects a Service to a Channel. However, it's not typically something you need to configure yourself, unless you're creating Channel and Subscription manually with Complex Delivery.

In Simple Delivery, there is no need for a Subscription as there is no Channel.

In Broker and Trigger Delivery (preferred delivery method), you create a Trigger with a subscriber:

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

This creates a Subscription under the covers:

$ kubectl get subscription

NAME
default-trigger-event-display-8e05f7c3-702e-49b4-96f8-c46764aff45c

In Complex Delivery, you need to define a Subscription manually to connect a Service to a Channel:

apiVersion: messaging.knative.dev/v1alpha1
kind: Subscription
metadata:
  name: subscription1
spec:
  channel:
    apiVersion: messaging.knative.dev/v1alpha1
    kind: InMemoryChannel
    name: channel
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: service1

Create it:

$ kubectl apply -f subscription.yaml
subscription.messaging.knative.dev/subscription1 created