Getting Started with Knative on Alibaba Cloud Service Kubernetes

Overview

Installing Knative Serving

Prepare Kubernetes

Installing Istio

Installing Istio Ingress Gateway

Installing Knative CRD

Installing Knative Serving

Getting Started with Knative

Deploy the Autoscale Sample

kubectl create -f autoscale.yaml
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: autoscale-go
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
metadata:
annotations:
# Target 10 in-flight-requests per pod.
autoscaling.knative.dev/target: "10"
autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
spec:
container:
image: registry.cn-beijing.aliyuncs.com/wangxining/autoscale-go:0.1

Load the Autoscale Service

export IP_ADDRESS=`kubectl get svc istio-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
curl --header "Host: autoscale-go.default.{domain.name}" "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5"
curl --header "Host: autoscale-go.default.aliyun.com" "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5"
Allocated 5 Mb of memory.
The largest prime less than 10000 is 9973.
Slept for 100.16 milliseconds.
go get -u github.com/rakyll/hey
hey -z 30s -c 50 \
-host "autoscale-go.default.aliyun.com" \
"http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5" \
&& kubectl get pods
Summary:
Total: 30.1126 secs
Slowest: 2.8528 secs
Fastest: 0.1066 secs
Average: 0.1216 secs
Requests/sec: 410.3270
Total data: 1235134 bytes
Size/request: 99 bytes
Response time histogram:
0.107 [1] |
0.381 [12305] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.656 [0] |
0.930 [0] |
1.205 [0] |
1.480 [0] |
1.754 [0] |
2.029 [0] |
2.304 [0] |
2.578 [27] |
2.853 [23] |
Latency distribution:
10% in 0.1089 secs
25% in 0.1096 secs
50% in 0.1107 secs
75% in 0.1122 secs
90% in 0.1148 secs
95% in 0.1178 secs
99% in 0.1318 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0001 secs, 0.1066 secs, 2.8528 secs
DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0000 secs
req write: 0.0000 secs, 0.0000 secs, 0.0023 secs
resp wait: 0.1214 secs, 0.1065 secs, 2.8356 secs
resp read: 0.0001 secs, 0.0000 secs, 0.0012 secs
Status code distribution:
[200] 12356 responses
NAME READY STATUS RESTARTS AGE
autoscale-go-00001-deployment-5fb497488b-2r76v 2/2 Running 0 29s
autoscale-go-00001-deployment-5fb497488b-6bshv 2/2 Running 0 2m
autoscale-go-00001-deployment-5fb497488b-fb2vb 2/2 Running 0 29s
autoscale-go-00001-deployment-5fb497488b-kbmmk 2/2 Running 0 29s
autoscale-go-00001-deployment-5fb497488b-l4j9q 1/2 Terminating 0 4m
autoscale-go-00001-deployment-5fb497488b-xfv8v 2/2 Running 0 29s

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com