Knative: Operator’s Handbook

Producing events

Events can be produced within the cluster by constructing a CloudEvent with the right headers and passing to Broker.

Broker URL is only accessible within the cluster, therefore, you need to use a Pod inside the cluster to make the request:

$ curl -v "http://default-broker.default.svc.cluster.local" \
  -X POST \
  -H "Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79" \
  -H "Ce-Specversion: 1.0" \
  -H "Ce-Type: dev.knative.samples.helloworld" \
  -H "Ce-Source: dev.knative.samples/helloworldsource" \
  -H "Content-Type: application/json" \
  -d '{"msg":"Hello Knative!"}'

The above CloudEvent is in Binary format but it can also be sent in Structured format. See CloudEvent for more details.

Broker responds with 202 if the event has been received:

< HTTP/1.1 202 Accepted
< Content-Length: 0
< Date: Fri, 06 Dec 2019 13:48:19 GMT