knative / eventing

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

The Trigger of Cloudevents-Player Can't Work #7844

Closed 120L020430 closed 1 month ago

120L020430 commented 5 months ago

Describe the bug A clear and concise description of what the bug is. I'm new to Knative. After installing knative serving and knative eventing, I try the trigger tutorial, but the trigger doesn't work correctly. It doesn't receive the message. The result of cloudevents player is below: image I find the SUBSCRIBER_URI of the trigger is different from the service.

$ kn service ls
NAME                 URL                                                         LATEST                     AGE   CONDITIONS   READY   REASON
cloudevents-player   http://cloudevents-player.default.192.168.31.206.sslip.io   cloudevents-player-00001   46m   3 OK / 3     True

$ kubectl get trigger
NAME                  BROKER    SUBSCRIBER_URI                                        AGE   READY   REASON
cloudevents-trigger   default   http://cloudevents-player.default.svc.cluster.local   32m   True

My k3s cluster has three nodes. I use kourier+magic DNS as the networking and DNS layer, following the installing turior. I use kafka as the channel and broker layer. It has the same three nodes.

cloudevents-player.yaml

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: cloudevents-player
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/min-scale: "1"
    spec:
      containers:
        - image: quay.io/ruben/cloudevents-player:latest
          env:
            - name: BROKER_URL
              value: http://kafka-broker-ingress.knative-eventing.svc.cluster.local/default/default

ce-trigger.yaml

apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: cloudevents-trigger
  annotations:
    knative-eventing-injection: enabled
spec:
  broker: default
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: cloudevents-player

Expected behavior A clear and concise description of what you expected to happen.

The trigger can work correctly like the tutorial.

To Reproduce Steps to reproduce the behavior.

Install knative following the YAML-based Installation, and use kourier, magic DNS and kafka. Finally, try the cloudevents player.

Knative release version v1.13.1 Additional context Add any other context about the problem here such as proposed priority

120L020430 commented 5 months ago

Let me elaborate on the situation:

I have a local three-node k3s cluster and apply serving-crds.yaml, serving-core.yaml, kourier.yaml, serving-default-domain.yaml, serving-hpa.yaml. After deploying example Hello, I get the following result:

image-20240501080335115

watch -n 0.5 kubectl get pod -l serving.knative.dev/service=hello -owideObserving the autoscaling, everything is fine at this point

#!/bin/bash
for ((i=0;i<=10000;i++)); do {
echo `curl -s http://hello.default.192.168.31.206.sslip.io`
} & done
wait

And then I applyeventing-crds.yamleventing-core.yaml, eventing-kafka-controller.yaml, eventing-kafka-channel.yaml and eventing-kafka-broker.yaml,and connect it with my local kafka cluster.

The broker is as follows:

apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
  annotations:
    # case-sensitive
    eventing.knative.dev/broker.class: Kafka
    # Optional annotation to point to an externally managed kafka topic:
    # kafka.eventing.knative.dev/external.topic: <topic-name>
  name: default
  namespace: default
spec:
  # Configuration specific to this broker.
  config:
    apiVersion: v1
    kind: ConfigMap
    name: kafka-broker-config
    namespace: knative-eventing

After testing the issue example, the problem arises.

Later I tried to use kafkasource and deployed this example and it failed.

The log of pod/kafka-source-dispatcher is as follows:

log.json

I think the most important is "ERROR","level_value":40000,"stack_trace":"io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Failed to resolve 'event-display.default.svc.cluster.local' [A(1)] and search domain query for configured domains failed as well: [knative-eventing.svc.cluster.local, svc.cluster.local, cluster.local]

Like the original hello, the address of event-display is actually event-display.default.192.168.31.206.sslip.io, but here it resolves event-display.default.svc.cluster.local

I don't know if I'm missing any files or if there's a mistake in the configuration somewhere.

pierDipi commented 5 months ago

@120L020430 can you show the full knative service status?

$ kubectl get ksvc hello -oyaml

if there is a URL like event-display.default.svc.cluster.local can you try to sending a request to it from a pod in the cluster?

there might be something wrong in your knative serving installation

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.