knative / eventing

Event-driven application platform for Kubernetes
https://knative.dev/docs/eventing
Apache License 2.0
1.41k stars 593 forks source link

Unable to get a basic broker working #5852

Closed bennidhamma closed 3 years ago

bennidhamma commented 3 years ago

Expected Behavior

When I create a broker and look at it with kn broker list, I would expect it to look something like this:

NAME             URL                                                                               AGE    CONDITIONS   READY   REASON
example-broker   http://broker-ingress.knative-eventing.svc.cluster.local/default/example-broker   2d1h   5 OK / 5     True  

Actual Behavior

Instead, it looks like this:

NAME             URL   AGE   CONDITIONS   READY       REASON
default-broker         23h   0 OK / 0     <unknown>   <unknown>

Steps to Reproduce the Problem

  1. Install knative-serving and knative-eventing into a kubernetes cluster (I downloaded the serving and eventing yamls from https://knative.dev/docs/admin/install/serving/install-serving-with-yaml and https://knative.dev/docs/admin/install/eventing/install-eventing-with-yaml)
  2. install an inmemory channel
  3. create a broker kn broker create default-broker
  4. list the broker

Additional Info

channel.yaml:

apiVersion: messaging.knative.dev/v1
kind: Channel
metadata:
  name: inmemorychannel

broker describe:

❯ kubectl describe broker default-broker
Name:         default-broker
Namespace:   *** redacted ***
Labels:       <none>
Annotations:  eventing.knative.dev/broker.class: MTChannelBasedBroker
              eventing.knative.dev/creator: developer-admin
              eventing.knative.dev/lastModifier: developer-admin
API Version:  eventing.knative.dev/v1
Kind:         Broker
Metadata:
  Creation Timestamp:  2021-10-27T23:11:59Z
  Generation:          1
  Managed Fields:
    API Version:  eventing.knative.dev/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
      f:status:
        .:
        f:address:
    Manager:         kn
    Operation:       Update
    Time:            2021-10-27T23:11:59Z
  Resource Version:  249681561
  UID:               fe68450a-4334-40a5-bacf-03981761dbba
Spec:
  Config:
    API Version:  v1
    Kind:         ConfigMap
    Name:         config-br-default-channel
    Namespace:    knative-eventing
Events:           <none>

Groups thread: https://groups.google.com/g/knative-users/c/k_d6zbD2xZc

Nothing suspicious looking in logs output from imc-dispatcher or imc-controller in the knative-eventing namespace, but I'm happy to attach those logs if that seems useful.

csantanapr commented 3 years ago

Which kubernetes cluster are you using? Minikube?

csantanapr commented 3 years ago

I was able to reproduce.

❯ kubectl get broker default-broker
NAME             URL   AGE   READY   REASON
default-broker         44s

You need to install the mt-channel-broker.yaml

Then I install the broker

kubectl apply -f https://github.com/knative/eventing/releases/download/v0.26.1/mt-channel-broker.yaml

Then do another get

❯ kubectl get broker default-broker
NAME             URL                                                                               AGE   READY   REASON
default-broker   http://broker-ingress.knative-eventing.svc.cluster.local/default/default-broker   89s   True
csantanapr commented 3 years ago

I was able to get it working based on the tutorials that I have here https://github.com/csantanapr/knative-kind/blob/master/04-eventing.sh

Also, you don't need serving if you are only using eventing.

export KNATIVE_EVENTING_VERSION=0.26.1
kubectl apply -f https://github.com/knative/eventing/releases/download/v$KNATIVE_EVENTING_VERSION/eventing-crds.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v$KNATIVE_EVENTING_VERSION/eventing-core.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v$KNATIVE_EVENTING_VERSION/in-memory-channel.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v$KNATIVE_EVENTING_VERSION/mt-channel-broker.yaml
sleep 10
kn broker create default-broker
kn broker list

output

NAME             URL                                                                               AGE     CONDITIONS   READY   REASON
default-broker   http://broker-ingress.knative-eventing.svc.cluster.local/default/default-broker   6m53s   5 OK / 5     True
csantanapr commented 3 years ago

@bennidhamma thank you for opening the issue, let us know if the info fixes your issue.

bennidhamma commented 3 years ago

Awesome. This is so helpful. Will try soonest.

On Wed, Oct 27, 2021, 17:33 Carlos Santana @.***> wrote:

@bennidhamma https://github.com/bennidhamma thank you for opening the issue, let us know if the info fixes your issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/knative/eventing/issues/5852#issuecomment-953407328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACLUMAGYM7RO7RRZKPASTLUJCK5PANCNFSM5G3P52SQ .

bennidhamma commented 3 years ago

looks great. thank you @csantanapr!

vaikas commented 3 years ago

@csantanapr this has come up a few times in the past, wondering if we might be able to add a section about this in the docs that would highlight this a bit more?

vaikas commented 3 years ago

I went to create an issue but took a look and there was one already, so added this as another datapoint there. Thanks all and sorry for the troubles :(

soaand01 commented 3 years ago

@vaikas How did you handled the DNS part ? Now I can get the URL as well, but seems I cannot do anything with it.

vaikas commented 3 years ago

Well, typically I just use cluster local since I really don't want to accept just any rando events from the Internet :)

There should be some samples in the knative.dev website, here's an example that hopefully shows how to:

soaand01 commented 3 years ago

@vaikas Thanks a lot. I'm going to try it again, I might have done something wrong.

soaand01 commented 3 years ago

@vaikas Did you have to use anything for networking? even locally, like Kourier for example.

csantanapr commented 3 years ago

@soaand01

@vaikas How did you handled the DNS part ? Now I can get the URL as well, but seems I cannot do anything with it.

If you want the URL to the broker to be external you can use what we use in quickstart here using DomainMapping https://github.com/csantanapr/knative-kind/blob/master/05-eventing-samples.sh#L61-L83 But you need to install serving and domain mapping.

# Exposing broker externally using Knative Domain Mapping
kubectl apply -f - <<EOF
apiVersion: networking.internal.knative.dev/v1alpha1
kind: ClusterDomainClaim
metadata:
  name: broker-ingress.knative-eventing.127.0.0.1.nip.io
spec:
  namespace: knative-eventing
EOF

kubectl -n knative-eventing apply -f - << EOF
apiVersion: serving.knative.dev/v1alpha1
kind: DomainMapping
metadata:
  name: broker-ingress.knative-eventing.127.0.0.1.nip.io
spec:
  ref:
    name: broker-ingress
    kind: Service
    apiVersion: v1
EOF
sleep 2
kubectl wait -n knative-eventing DomainMapping broker-ingress.knative-eventing.127.0.0.1.nip.io --timeout=-1s --for=condition=Ready > /dev/null
soaand01 commented 3 years ago

@csantanapr I will try it now.

soaand01 commented 3 years ago

@csantanapr Is the kourier really necessary to make it work ?

csantanapr commented 3 years ago

@soaand01 Is using domain mapping and serving to make the service external thru the serving network plugin in my example I use Kourier but you can use any of the serving net-* like istio, contour, etc