knative / serving

Kubernetes-based, scale-to-zero, request-driven compute
https://knative.dev/docs/serving/
Apache License 2.0
5.58k stars 1.16k forks source link

Call Camel-K integration exposed via Knative serving on GKE #13816

Closed robertofabrizi closed 1 year ago

robertofabrizi commented 1 year ago

Expected Behavior

Hello everyone, I've been trying to reproduce this demo: https://www.youtube.com/watch?v=Wmg7-PZgQJI&list=WL&index=6&t=1628s and for the most part it seems to work, I have the exact same behaviour in terms of Camel-K, Quarkus native and so on, but I can't seem to understand how I'm supposed to invoke the Knative service. I'm using GKE with Knative from the Google Store, so it runs Knative and Istio. On top of that I installed Camel-k, configured the image repository etc. When the integration starts, I can't seem to undestand how I'm supposed to invoke it though, can anyone help me figure it out? Thank you very much!!

Additional Info

Immagine 2023-03-27 120636

ReToCode commented 1 year ago

I'm not sure I get your question. Typically Knative Services are called trough a networking layer. In your case that seems to be istio? If so, you'd probably set up a DNS records for the public (load balancer) IP of istio and configure Knative domain according to that DNS record. Check out https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#install-a-networking-layer and the following paragraphs for more info on this.

/triage needs-user-input

robertofabrizi commented 1 year ago

Thank you for your help @ReToCode . I've started the project using this https://console.cloud.google.com/marketplace/product/google/knative?project=stable-being-381621 which, from my understanding, was a out-of-the-box installation of Knative + Istio on a GKE cluster. I notice that it installed everything in the default namespace (maybe I'm to blame for it, I'm not sure that I had the option to specify differently), so it's already a bit different than the situation expected from example by this kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-default-domain.yaml because there is no knative-serving namespace. Another thing that I noticed is that I miss a knative-ingress-gateway, I only have a knative-local-gateway and the default istio-ingress-gateway. Is it safer to just throw it all away and restart with a vanilla GKE cluster and install Istio and Knative manually? Thank you, Roberto

ReToCode commented 1 year ago

Hm I'm not familiar with that setup, as it is not from us (Knative), its from https://github.com/GoogleCloudPlatform/click-to-deploy. But what I can see from their docs, you still need to point your Domain and DNS to the public IP. Check out https://github.com/GoogleCloudPlatform/click-to-deploy/tree/master/k8s/knative#get-the-ingress-public-address. Not sure about the changes to their default setup though.

robertofabrizi commented 1 year ago

Thank you, I'll try again from scratch and see how it goes

robertofabrizi commented 1 year ago

@ReToCode I've followed that tutorial up to the point where it mentions how to change the default domain, which I don't intend to do. At this point I have:

r_fabrizi83@cloudshell:~/click-to-deploy/k8s/knative (ipaas-381912)$ kubectl get ksvc helloworld-go  --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME            DOMAIN
helloworld-go   <none>

r_fabrizi83@cloudshell:~/click-to-deploy/k8s/knative (ipaas-381912)$ kn services list
NAME            URL                                              LATEST             AGE   CONDITIONS   READY   REASON
helloworld-go   http://helloworld-go.default.svc.cluster.local   helloworld-go-v1   28m   3 OK / 3     True

r_fabrizi83@cloudshell:~/click-to-deploy/k8s/knative (ipaas-381912)$ kubectl get svc | grep istio
helloworld-go                ExternalName   <none>          knative-local-gateway.istio-system.svc.cluster.local   80/TCP                                               28m
istio-ingressgateway         LoadBalancer   10.104.10.106   34.140.XX.XXX                                          15021:31182/TCP,80:30349/TCP,443:30250/TCP           32m
istiod                       ClusterIP      10.104.9.95     <none>                                                 15010/TCP,15012/TCP,443/TCP,15014/TCP                32m
net-istio-webhook            ClusterIP      10.104.6.66     <none>                                                 9090/TCP,8008/TCP,443/TCP                            32m

r_fabrizi83@cloudshell:~/click-to-deploy/k8s/knative (ipaas-381912)$ curl -v -H "Host: helloworld-go.default.svc.cluster.local" http://34.140.XX.XXX
*   Trying 34.140.XX.XXX:80...
* Connected to 34.140.XX.XXX (34.140.XX.XXX) port 80 (#0)
> GET / HTTP/1.1
> Host: helloworld-go.default.svc.cluster.local
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< date: Mon, 27 Mar 2023 14:39:39 GMT
< server: istio-envoy
< content-length: 0
<
* Connection #0 to host 34.140.XX.XXX left intact

Is it because for some reason I'm missing the value at the .status.domain of the kubectl get ksvc helloworld-go --output jsonpath='{.status.domain}'?

Thank you, very much appreciate it!

dprotaso commented 1 year ago

You'll need to configure Knative with your external domain name.

See Real DNS here https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#install-optional-serving-extensions

robertofabrizi commented 1 year ago

You'll need to configure Knative with your external domain name.

See Real DNS here https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#install-optional-serving-extensions

Thank you, I'll check it out again, I kinda skipped it because the premise is "You can configure DNS to prevent the need to run curl commands with a host header." and while convenient, I'm passing the Host header, so I figured that it should have worked anyway.

dprotaso commented 1 year ago

Looks like your use case falls under 'Temporary DNS' which isn't really obvious. We should update that. Curious if you have a suggestion on the name.

robertofabrizi commented 1 year ago

@dprotaso Thank you so much, it solved my issue. I'm not really sure of a better name to be honest with you, maybe I got confused by the mention of ipv6 or minikube (neither of which I'm using) into thinking that it wouldn't apply to my case. I'm not really sure if I'd rename it, or maybe explicitly adding some more "use cases" besides ipv6 and minikube might help people more.

dprotaso commented 1 year ago

Ok thanks - I created a doc PR to change the name to No DNS

https://github.com/knative/docs/pull/5520