The Boba Cybercafe

Share this post

Knative — Curling the Knative Broker Directly

btong.substack.com

Knative — Curling the Knative Broker Directly

↳ 📅 8/25/2022 ✍ guide, software, programming, knative

Bryan
Nov 11, 2022
Share this post

Knative — Curling the Knative Broker Directly

btong.substack.com
Source 1 and Source 2 are transmitting some data -- ones and twos -- to the Broker, which then gets filtered by Triggers to the desired Sink.

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.

  1. 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.

    1. Ensure you have a working Knative installation (verified on Knative 1.8)

    2. Ensure you have a working Knative Broker configured

  2. Port forward to the Broker's ingress:

    kubectl port-forward -n knative-eventing svc/broker-ingress 8080:80
  3. 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

Thanks for reading Bryan Talks Too Much! Subscribe for free to receive new posts and support my work.

Share this post

Knative — Curling the Knative Broker Directly

btong.substack.com
Comments
TopNew

No posts

Ready for more?

© 2023 Bryan
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing