From 911ca4117a9e1dee93749c6af5d45efdc79cb42e Mon Sep 17 00:00:00 2001 From: Sam O'Dell <31352624+samodell@users.noreply.github.com> Date: Wed, 18 Jul 2018 14:16:22 -0700 Subject: [PATCH] Fixes numbered list formatting --- serving/samples/autoscale-go/README.md | 105 +++++++++++++------------ 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/serving/samples/autoscale-go/README.md b/serving/samples/autoscale-go/README.md index 88f2bcd32..ae244fa1e 100644 --- a/serving/samples/autoscale-go/README.md +++ b/serving/samples/autoscale-go/README.md @@ -16,83 +16,84 @@ go get -d github.com/knative/docs/serving/samples/autoscale-go Build the application container and publish it to a container registry: 1. Move into the sample directory: -``` -cd $GOPATH/src/github.com/knative/docs -``` + ``` + cd $GOPATH/src/github.com/knative/docs + ``` 1. Set your preferred container registry: -``` -export REPO="gcr.io/" -``` - * This example shows how to use Google Container Registry (GCR). You will need a Google Cloud Project and to enable the [Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com). - + ``` + export REPO="gcr.io/" + ``` + * This example shows how to use Google Container Registry (GCR). You will need a + Google Cloud Project and to enable the + [Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com). 1. Use Docker to build your application container: -``` -docker build \ - --tag "${REPO}/serving/samples/autoscale-go" \ - --file=serving/samples/autoscale-go/Dockerfile . -``` + ``` + docker build \ + --tag "${REPO}/serving/samples/autoscale-go" \ + --file=serving/samples/autoscale-go/Dockerfile . + ``` 1. Push your container to a container registry: -``` -docker push "${REPO}/serving/samples/autoscale-go" -``` + ``` + docker push "${REPO}/serving/samples/autoscale-go" + ``` 1. Replace the image reference with our published image: -``` -perl -pi -e \ -"s@github.com/knative/docs/serving/samples/autoscale-go@${REPO}/serving/samples/autoscale-go@g" \ -serving/samples/autoscale-go/sample.yaml -``` + ``` + perl -pi -e \ + "s@github.com/knative/docs/serving/samples/autoscale-go@${REPO}/serving/samples/autoscale-go@g" \ + serving/samples/autoscale-go/sample.yaml + ``` ## Deploy the Service 1. Deploy the Knative Serving sample: -``` -kubectl apply -f serving/samples/autoscale-go/sample.yaml -``` + ``` + kubectl apply -f serving/samples/autoscale-go/sample.yaml + ``` 1. Find the ingress hostname and IP and export as an environment variable: -``` -export SERVICE_HOST=`kubectl get route autoscale-route -o jsonpath="{.status.domain}"` -export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"` -``` + ``` + export SERVICE_HOST=`kubectl get route autoscale-route -o jsonpath="{.status.domain}"` + export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"` + ``` ## View the Autoscaling Capabilities 1. Request the largest prime less than 40,000,000 from the autoscale app. Note that it consumes about 1 cpu/sec. -``` -time curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP?}/primes/40000000 -``` + ``` + time curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP?}/primes/40000000 + ``` -1. Ramp up traffic on the autoscale app (about 300 QPS). -``` -kubectl delete namespace hey --ignore-not-found && kubectl create namespace hey -``` -``` -for i in `seq 2 2 60`; do - kubectl -n hey run hey-$i --image josephburnett/hey --restart Never -- \ - -n 999999 -c $i -z 2m -host $SERVICE_HOST \ - "http://${SERVICE_IP?}/primes/40000000" - sleep 1 -done -``` +1. Ramp up traffic on the autoscale app (about 300 QPS): + ``` + kubectl delete namespace hey --ignore-not-found && kubectl create namespace hey + ``` + ``` + for i in `seq 2 2 60`; do + kubectl -n hey run hey-$i --image josephburnett/hey --restart Never -- \ + -n 999999 -c $i -z 2m -host $SERVICE_HOST \ + "http://${SERVICE_IP?}/primes/40000000" + sleep 1 + done + ``` 1. Watch the Knative Serving deployment pod count increase. -``` -kubectl get deploy --watch -``` + ``` + kubectl get deploy --watch + ``` 1. Watch the pod traffic ramp up. -``` -kubectl get pods -n hey --show-all --watch -``` + ``` + kubectl get pods -n hey --show-all --watch + ``` 1. Look at the latency, requests/sec and success rate of each pod. -``` -for i in `seq 2 2 60`; do kubectl -n hey logs hey-$i ; done -``` + ``` + for i in `seq 2 2 60`; do kubectl -n hey logs hey-$i ; done + ``` ## Cleanup