In Knative Eventing, a Broker represents an "event mesh". Events are sent to the Broker's ingress and are then sent to any subscribers that are interested in that event. Brokers are currently backed by a configurable Channel. In this guide, we show an example of how to configure a Broker backed by the Pub/Sub Channel.
-
Install Knative-GCP. Remember to install Knative Eventing.
-
Verify the configmap
config-br-default-channelis in thecloud-run-eventsnamespace.kubectl get configmap config-br-default-channel -n cloud-run-events
By default, it is assumed to use a default secret. Modify
config-br-default-channelto use a different method and apply it. The two options are:-
If you are in GKE and using Workload Identity, update
serviceAccountNamewith the Pub/Sub enabled service account you created in Create a Service Account for the Data Plane. -
If you are using standard Kubernetes secrets, but want to use a non-default one, update
secretwith your own secret.
kubectl apply -f config-br-default-channel.yaml
-
-
Patch the configmap in the
knative-eventingnamespace to use the Pub/SubChannelas the default channel for Brokers with patch-config-br-defaults-with-pubsub.yaml.kubectl patch configmap config-br-defaults -n knative-eventing --patch "$(cat patch-config-br-defaults-with-pubsub.yaml)" -
Add the
knative-eventing-injectionlabel to your namespace with the following command.kubectl label namespace default knative-eventing-injection=enabled
This triggers a reconciliation process that creates the
default Brokerin that namespace. -
Verify that the
Brokeris runningkubectl --namespace default get broker default
This shows the
Brokerthat you created:NAME READY REASON URL AGE default True http://default-broker.default.svc.cluster.local 1m
When the
Brokerhas theREADY=Truestate, it can start processing any events it receives.