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-channel
is in thecloud-run-events
namespace.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-channel
to use a different method and apply it. The two options are:-
If you are in GKE and using Workload Identity, update
serviceAccountName
with 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
secret
with your own secret.
kubectl apply -f config-br-default-channel.yaml
-
-
Patch the configmap in the
knative-eventing
namespace to use the Pub/SubChannel
as 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-injection
label to your namespace with the following command.kubectl label namespace default knative-eventing-injection=enabled
This triggers a reconciliation process that creates the
default Broker
in that namespace. -
Verify that the
Broker
is runningkubectl --namespace default get broker default
This shows the
Broker
that you created:NAME READY REASON URL AGE default True http://default-broker.default.svc.cluster.local 1m
When the
Broker
has theREADY=True
state, it can start processing any events it receives.