Knative — Curling the Knative Broker Directly
↳ 📅 8/25/2022 ✍ guide, software, programming, knative
When using Knative, a developer may want to sometimes directly curl
the broker without configuring a source, as Knative traditionally requires. This guide explains how to work around that for a faster development cycle.
From the Knative documentation, the suggested interacted path is that your
curl
hits a configured Knative Source, which is sent to a Broker, which then sends (in a one-to-many relationship) to Sinks (consumers). While this is great for production-ready scenarios, a developer may not want to configure all of these CRDs during a simple development test.Ensure you have a working Knative installation (verified on Knative 1.8)
Ensure you have a working Knative Broker configured
Port forward to the Broker's ingress:
kubectl port-forward -n knative-eventing svc/broker-ingress 8080:80
curl to localhost:
curl -w'\n' http://localhost:8080/demo/default \ -H "ce-id: 0001" \ -H "ce-specversion: 1.0" \ -H "ce-type: hello" \ -H "ce-source: somewhere" \ -H "Content-Type: application/json" \ -X POST -i
Written as of Knative 1.8 -- hope this helps.
- bryan