Skip to content

unexist/showcase-knative-camel-quarkus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Showcase for Knative eventing based on Camel and Quarkus

This project holds a showcase Knative eventing with Camel and Quarkus.

Create Minikube cluster

minikube start --driver=virtualbox --cpus=4 --memory=8192m
minikube addons enable metrics-server
minikube addons enable registry
minikube addons enable istio-provisioner
minikube addons enable istio
minikube tunnel & #< Asks for sudo password!

Install Knative

kubectl apply -f https://github.com/knative/operator/releases/download/v0.25.0/operator.yaml
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
    name: knative-eventing
---
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeEventing
metadata:
    name: knative-eventing
    namespace: knative-eventing
---
apiVersion: v1
kind: Namespace
metadata:
    name: knative-serving
---
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
    name: knative-serving
    namespace: knative-serving
EOF
kubectl apply -f https://github.com/knative/serving/releases/download/v0.25.0/serving-default-domain.yaml

Install Kourier and configure DNS

kubectl apply -f https://github.com/knative/net-kourier/releases/download/v0.25.0/kourier.yaml

EXTERNAL_IP=$(kubectl -n kourier-system get service kourier -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo EXTERNAL_IP=$EXTERNAL_IP

KNATIVE_DOMAIN="$EXTERNAL_IP.nip.io"
echo KNATIVE_DOMAIN=$KNATIVE_DOMAIN

kubectl patch configmap -n knative-serving config-domain -p "{\"data\": {\"$KNATIVE_DOMAIN\": \"\"}}"

kubectl patch configmap/config-network \
  --namespace knative-serving \
  --type merge \
  --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'

Install Knative CLI

brew install knative/client/kn

Verify installation

Check knative-eventing

kubectl get KnativeEventing knative-eventing -n knative-eventing

NAME               VERSION   READY   REASON
knative-eventing   0.25.0    True

kubectl get deployment -n knative-eventing

Check knative-serving

kubectl get KnativeServing knative-serving -n knative-serving

NAME              VERSION   READY   REASON
knative-serving   0.25.0    True

kubectl get deployment -n knative-serving

Check logs of the operator

kubectl logs -f deploy/knative-operator

Install Kamel

brew install kamel
kamel install --olm=false

Install Kafka

kubectl create namespace kafka
kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka
kubectl apply -f https://strimzi.io/examples/latest/kafka/kafka-persistent-single.yaml -n kafka

Install Redpanda

kubectl apply -f - <<EOF

EOF
kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.25.0/eventing-kafka-controller.yaml
kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.25.0/eventing-kafka-broker.yaml
kubectl apply -f https://storage.googleapis.com/knative-releases/eventing-contrib/latest/kafka-source.yaml
kubectl apply -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
    annotations:
        eventing.knative.dev/broker.class: Kafka
    name: default
    namespace: default
spec:
    config:
        apiVersion: v1
        kind: ConfigMap
        name: kafka-broker-config
        namespace: knative-eventing
EOF
kubectl apply -f - <<EOF
apiVersion: sources.knative.dev/v1beta1
kind: KafkaSource
metadata:
  name: kafka-source-todo
spec:
  bootstrapServers:
    - redpanda:9092
  topics:
    - todo-created
  sink:
    ref:
      apiVersion: eventing.knative.dev/v1
      kind: Broker
      name: default
---
apiVersion: bindings.knative.dev/v1beta1
kind: KafkaBinding
metadata:
  name: kafka-binding-todo
spec:
  subject:
    apiVersion: serving.knative.dev/v1
    kind: Service
    name: todo
  bootstrapServers:
    - redpanda:9092
---
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: todo-trigger
spec:
  broker: default
  filter:
    attributes:
      type: dev.knative.kafka.event
      source: /apis/v1/namespaces/default/kafkasources/kafka-source-todo#todo-created
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: todo
    uri: /todo/create
EOF

Problems

Broker cannot be reached from Camel

 [Producer clientId=producer-1] Connection to node 1 (/0.0.0.0:9092) could not be established. Broker may not be available.

External IP pending

kubectl -n kourier-system get service kourier

minikube tunnel asks for a password which I wasn’t aware of.

Knative-serving is not ready

kubectl get KnativeServing knative-serving -n knative-serving

NAME              VERSION   READY   REASON
knative-serving             False   Error

Istio is missing, check the operator logs.

Subject missing in kafka binding

kubectl get kafkabindings.bindings.knative.dev

NAME                 BOOTSTRAPSERVERS    READY   REASON           AGE
kafka-binding-todo   ["redpanda:9092"]   False   SubjectMissing   3h58m