Serving: curl failed when trying code sample of autoscaler

Created on 6 Oct 2020  ·  9Comments  ·  Source: knative/serving

Ask your question here:

environment

knative-serving on minikube

do what?

I followed this page https://knative.dev/docs/serving/autoscaling/autoscale-go/index.html to try autoscaler and meet some trouble.

I don't know what caused the routing not to work. In addition, I only deployed serving but not eventing, I think this should not affect it, right?

 kubectl get ksvc autoscale-go
NAME           URL                                       LATESTCREATED        LATESTREADY          READY   REASON
autoscale-go   http://autoscale-go.default.example.com   autoscale-go-tcw8t   autoscale-go-tcw8t   True 

curl  "http://autoscale-go.default.example.com?sleep=100&prime=10000&bloat=5"
curl: (6) Could not resolve host: autoscale-go.default.example.com

reference

kubectl get pods -n knative-serving
NAME                                READY   STATUS             RESTARTS   AGE
activator-5499698f64-kx457          1/1     Running            13         2d23h
autoscaler-746c56d9d7-66sd4         1/1     Running            13         2d23h
controller-7cd5bc7554-8f7hz         1/1     Running            13         2d23h
istio-webhook-797d546fb6-g87nx      1/1     Running            2          2d17h
networking-istio-74d5d595cb-47fl9   1/1     Running            2          2d17h
webhook-64fdff996-4k88x             1/1     Running            16         2d23h

kubectl get deployment -n knative-serving
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
activator          1/1     1            1           4d23h
autoscaler         1/1     1            1           4d23h
controller         1/1     1            1           4d23h
istio-webhook      1/1     1            1           4d23h
networking-istio   1/1     1            1           4d23h
webhook            1/1     1            1           4d23h

wish

Hope everything goes well with your work!

kinquestion

Most helpful comment

@amtisyAts Sorry I copied your command and didn't notice that you specified /sleep. Please specified sleep as below:

curl -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT?sleep=100&prime=10000&bloat=5"

All 9 comments

You can't query directly with example.com. You either need to setup your domain or spoof the host via ingress IP address + Host header.

environment

knative-serving on minikube

do what

thanks,I might have solved this and got another.

request

curl -s -I -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT/sleep=10"

response

HTTP/1.1 200 OK
date: Tue, 06 Oct 2020 09:24:20 GMT
x-envoy-upstream-service-time: 1873
server: istio-envoy
transfer-encoding: chunked

expect

curl sucessed but i want to get some http response just like the following instead of some info from istio. Is this buceuse i lack some components?

request

curl "http://autoscale-go.default.1.2.3.4.xip.io?sleep=100&prime=10000&bloat=5"

response

Allocated 5 Mb of memory.
The largest prime less than 10000 is 9973.
Slept for 100.13 milliseconds.

curl "http://autoscale-go.default.1.2.3.4.xip.io?sleep=100&prime=10000&bloat=5"

Did you replace 1.2.3.4.xip.io with your ${INGRESS_IP}.xip.io? 1.2.3.4.xip.io is just an example.

oh,it's just an example from knative-serving code sample of autoscaler
in the following page
https://knative.dev/docs/serving/autoscaling/autoscale-go/index.html

Thank you. I understand.
Then can you drop -I option from your curl command? You should run this command:

curl -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT/sleep=10"

thank you for responing quickly!

i get no response with this command.
in the instruction of this page https://knative.dev/docs/serving/autoscaling/autoscale-go/index.html
the following looks like http response.But i don't know either it is response or log
```shell
Allocated 5 Mb of memory.
The largest prime less than 10000 is 9973.
Slept for 100.13 milliseconds.

i can get SUCESS_CODE 200 when run curl -I -H...

HTTP/1.1 200 OK
date: Tue, 06 Oct 2020 09:24:20 GMT
x-envoy-upstream-service-time: 1873
server: istio-envoy
transfer-encoding: chunked

but get no response when run curl -H ...
it looks so strange

@amtisyAts Sorry I copied your command and didn't notice that you specified /sleep. Please specified sleep as below:

curl -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT?sleep=100&prime=10000&bloat=5"

thanks, i tried the following and also got code 200

curl -s -I -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT"
HTTP/1.1 200 OK
date: Tue, 06 Oct 2020 12:29:16 GMT
x-envoy-upstream-service-time: 0
server: istio-envoy
transfer-encoding: chunked

i guess adding param -I makes istio only care whether it can be routed or not

thanks for replying .i have got what i want

curl -H Host:autoscale-go.default.amtisy.com "http://$INGRESS_HOST:$INGRESS_PORT?sleep=100&prime=10000&bloat=5"
Allocated 5 Mb of memory.
The largest prime less than 10000 is 9973.
Slept for 100.08 milliseconds.
Was this page helpful?
0 / 5 - 0 ratings