knativeknative-servingknative-eventing

Can Knative's Kafka Broker be fed with events from outside its cluster?


When I setup a kafka broker, its URL by default using

e.g. "http://kafka-broker-ingress.knative-eventing.svc.cluster.local/example/default"

I am only able to send event from resource within k8 cluster.

Is it possible to setup a kafka broker using public facing URL, so that it could receive events from outside the cluster? If can. How?

Thank you


Solution

  • This isn't supported out-of-the-box but you can use a Kubernetes ingress.

    A minimal example:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-default-broker
      namespace: knative-eventing
    spec:
      rules:
      - host: <my_host>
        http:
          paths:
          - path: /example/default
            pathType: Exact
            backend:
              service:
                name: kafka-broker-ingress
                port:
                  number: 80
    

    If you want to create the ingress resource in your example namespace and connect it to the kafka-broker-ingress service, look at Kubernetes Cross Namespace Ingress Network.