Knative Eventing uses the default broker unless otherwise specified.

If you have cluster administrator permissions, you can create the default broker automatically using namespace annotation.

All other users must create a broker using the manual process as described in this guide.

Creating a broker manually

To create a broker, you must create a ServiceAccount for each namespace and give that ServiceAccount the required RBAC permissions.

  • Knative Eventing installed, which includes the ClusterRole.

  1. Create the ServiceAccount objects:

    $ oc -n default create serviceaccount eventing-broker-ingress
    $ oc -n default create serviceaccount eventing-broker-filter
  2. Give those objects RBAC permissions:

    $ oc -n default create rolebinding eventing-broker-ingress \
      --clusterrole=eventing-broker-ingress \
    $ oc -n default create rolebinding eventing-broker-filter \
      --clusterrole=eventing-broker-filter \
  3. Create the broker:

    cat << EOF | oc apply -f -
    kind: Broker
      namespace: default
      name: default (1)
    1 This example uses the name default, but you can replace this with any other valid name.

Creating a broker automatically using namespace annotation

If you have cluster administrator permissions, you can create a broker automatically by annotating a namespace.

  • Knative Eventing installed.

  • Cluster administrator permissions for OpenShift Container Platform.

  1. Annotate your namespace by entering the following commands:

    $ oc label namespace default knative-eventing-injection=enabled (1)
    $ oc -n default get broker default
    1 Replace default with the desired namespace.

    The line shown in this example will automatically create a broker named default in the default namespace.

Brokers created due to annotation will not be removed if you remove the annotation. You must manually delete them.

Deleting a broker that was created using namespace annotation

  1. Delete the injected broker from the selected namespace (in this example, the default namespace):

    $ oc -n default delete broker default