Skip to content

Commit 57383e3

Browse files
committed
Misc fixes for the Knative tutorial too small to warrant their own issues
1 parent 8fa5df0 commit 57383e3

16 files changed

Lines changed: 65 additions & 111 deletions

01-basics/.editorconfig

Lines changed: 0 additions & 15 deletions
This file was deleted.

documentation/modules/ROOT/nav.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
** xref:01-setup.adoc#kubernetes-cluster[Kubernetes Cluster]
55
*** xref:01-setup.adoc#install-knative-minikube[Install with Minikube ]
66
**** xref:01-setup.adoc#start-minikube[Configure and Start minikube ]
7-
**** xref:01-setup.adoc[Install Knative ]
87
**** xref:01-setup.adoc#install-knative-istio[Install Istio ]
98
**** xref:01-setup.adoc#install-knative-serving[Install Knative Serving ]
109
**** xref:01-setup.adoc#install-knative-build[Install Knative Build]
@@ -44,7 +43,7 @@
4443
** xref:04-scaling.adoc#scaling-invoke-service[Invoke Service]
4544
** xref:04-scaling.adoc#scaling-scale-to-zero[Scale to Zero]
4645
*** xref:04-scaling.adoc#scaling-observer-scale-to-zero[Observing default scale down ]
47-
*** xref:04-scaling.adoc#scaling-observer-scale-to-zero-1m[Change scale to zero time]
46+
*** xref:04-scaling.adoc#scaling-observer-scale-to-zero-1m[Change scale-to-zero time]
4847
*** xref:04-scaling.adoc#scaling-reset-to-defaults[Reset to Defaults]
4948
** xref:04-scaling.adoc#scaling-auto-scaling[Auto Scaling]
5049
*** xref:04-scaling.adoc#scaling-autoscaling-deploy-service[Deploy Service]

documentation/modules/ROOT/pages/01-setup.adoc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,22 @@ The following CLI tools are required for running the exercises in this tutorial.
99
[cols="4*^,4*."]
1010
|===
1111
|**Tool** |**macOS** |**Fedora** | **Remarks**
12-
| `minikube`
12+
| `minikube`
1313
| https://kubernetes.io/docs/setup/minikube
1414
| https://kubernetes.io/docs/setup/minikube
1515
|
1616

17-
| `minishift`
17+
| `minishift`
1818
| https://github.com/minishift/minishift/releases
1919
| https://github.com/minishift/minishift/releases
2020
|
2121

22-
| https://maven.apacge.org[Apache Maven]
22+
| `git`
23+
| https://git-scm.com/download/mac
24+
| `dnf install git`
25+
|
26+
27+
| https://maven.apache.org[Apache Maven]
2328
| `brew install maven`
2429
| `dnf install maven`
2530
|
@@ -41,12 +46,12 @@ The following CLI tools are required for running the exercises in this tutorial.
4146

4247
| https://github.com/JoeDog/siege[siege]
4348
| `brew install siege`
44-
| https://github.com/JoeDog/siege
49+
| `dnf install siege`
4550
|
4651

4752
| watch
48-
|`brew install watch`
49-
| it will be pre-installed
53+
| `brew install watch`
54+
| `dnf install procps-ng`
5055
|
5156

5257
| kubectx and kubens
@@ -57,14 +62,14 @@ The following CLI tools are required for running the exercises in this tutorial.
5762

5863
[#download-tutorial-sources]
5964
== Download Tutorial Sources
60-
Before we start to setting up the environment, lets clone the tutorial sources and call the cloned folder as `$TUTORIAL_HOME`
65+
Before we start setting up the environment, let's clone the tutorial sources and set the `TUTORIAL_HOME` environment variable to point to the root directory of the tutorial:
6166

6267
[source,bash]
6368
----
6469
git clone https://github.com/redhat-developer-demos/knative-tutorial
6570
----
6671

67-
The `work` folder in `$TUTORIAL_HOME` can be used to download the demo application resources and refer them during the exercises. The `work` folder has a README, which has instructions on source code repo and git commands to clone the sources.
72+
The `work` folder in `$TUTORIAL_HOME` can be used to download the demo application resources and refer to them during the exercises. The `work` folder has a README with instructions on the source code repo and git commands to clone the sources.
6873

6974
[IMPORTANT,subs="+macros,+attributes"]
7075
====
@@ -86,4 +91,4 @@ include::partial$openshift-setup.adoc[]
8691
[#setup-work-folder]
8792
== Work folder
8893

89-
The work folder i.e `$TUTORIAL_HOME/work` can be used as a work directory during the build. The README in the work folder as the GitHub repository links of the applications `greeter` and `event-greeter` that will be used in various exercises.
94+
The work folder i.e `$TUTORIAL_HOME/work` can be used as a work directory during the build. The README in the work folder has the GitHub repository links of the applications `greeter` and `event-greeter` that will be used in various exercises.

documentation/modules/ROOT/pages/02-basic-fundas.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ NOTE: Sometimes the response might not be returned immediately especially when t
8888
[#basics-see-what-you-have-deployed]
8989
== See what you have deployed
9090

91-
The service based deployment strategy that we did now will create many knative resources, the following commands will help you to query and find what has been deployed.
91+
The service-based deployment strategy that we did now will create many Knative resources, the following commands will help you to query and find what has been deployed.
9292

9393
[#basics-show-knative-services]
9494
=== service

documentation/modules/ROOT/pages/03-configs-and-routes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include::partial$build-containers.adoc[tag=greeter]
2020

2121
In the previous chapter we saw how we can deploy services using a holistic service resource file, in this chapter we will see how to deploy the service using configurations and route files.
2222

23-
Navigate to the tutorial chapter's `knative` folder:
23+
Navigate to the tutorial chapter's folder:
2424

2525
[source,bash,subs="+macros,+attributes"]
2626
----

documentation/modules/ROOT/pages/04-scaling.adoc

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The last `curl` command should return a response like **Hi greeter => greeter-00
8686
Check <<02-basic-fundas.adoc#see-what-you-have-deployed,deployed Knative resources>> for more details on which Knative objects and resources have been created with the service deployment above.
8787

8888
[#scaling-scale-to-zero]
89-
== Configure scale to zero
89+
== Configure scale-to-zero
9090

9191
Assuming that <<scaling-deploy-service, Greeter service>> has been deployed, once no more traffic is seen going into that service, we'd like to scale this service down to zero replicas. That's called **scale-to-zero**.
9292

@@ -95,7 +95,7 @@ Scale-to-zero is one of the main properties making Knative a serverless platform
9595
If another request tries to get to this revision, the activator will get it, instruct the autoscaler to create new pods for the revision as quickly as possible and buffer the request until those new pods are created.
9696

9797
[#scale-to-zero-formulae]
98-
=== Calculating scale to zero time period
98+
=== Calculating scale-to-zero time period
9999

100100
The Knative autoscaler uses the config map **config-autoscaler** in the **knative-serving** namespace for autoscaling related properties. The values of the attribute `stable-window` and `scale-to-zero-grace-period`, which we've seen above, are part of this config map.
101101

@@ -131,6 +131,13 @@ As described above, the time it takes to finally scale to zero will be `STABLE_W
131131

132132
For easier observation let us open a new terminal and run the following command,
133133

134+
[source,bash,subs="+macros,+attributes"]
135+
----
136+
watch 'kubectl get pods -n knativetutorial'
137+
----
138+
139+
.(OR)
140+
134141
[source,bash,subs="+macros,+attributes"]
135142
----
136143
watch 'oc get pods -n knativetutorial'
@@ -147,7 +154,7 @@ echo $STABLE_WINDOW
147154
echo $SCALE_TO_ZERO_GRACE_PERIOD
148155
----
149156

150-
By default the **scale-to-zero-grace-period** is `30s`, and the **stable-window** is `60s`. Firing a request to the greeter service will bring up the pod (if it is already terminated, as described above) to serve the request. Leaving it without any further requests will automatically cause it to scale to zero in `1 min 30 secs`(<<scale-to-zero-formulae,Compute scale to zero grace period>>).
157+
By default the **scale-to-zero-grace-period** is `30s`, and the **stable-window** is `60s`. Firing a request to the greeter service will bring up the pod (if it is already terminated, as described above) to serve the request. Leaving it without any further requests will automatically cause it to scale to zero in `1 min 30 secs`(<<scale-to-zero-formulae,Compute scale-to-zero grace period>>).
151158

152159
[#scaling-observer-scale-to-zero-1m]
153160
=== Scale to zero in 1 minute
@@ -189,47 +196,10 @@ oc -n knative-serving get configmap config-autoscaler -o yaml \
189196
| yq r - data.scale-to-zero-grace-period
190197
----
191198

192-
Now <<scaling-invoke-service,firing the request>> to the greeter service will bring up the pod to serve the request again. Leaving it without any further requests, it will automatically scale to zero in `2 mins`(<<scale-to-zero-formulae,Compute scale to zero grace period>>)
193-
194-
[#scaling-observer-scale-to-zero-2m]
195-
=== Scale to zero in 2 minute
196-
197-
Let us now update **scale-to-zero-grace-period** to `2m` and leave the **stable-window** to default `60s`.
198-
199-
[source,bash,subs="+macros,+attributes"]
200-
----
201-
kubectl -n knative-serving get cm config-autoscaler -o yaml | yq w - -s link:{github-repo}/{scaling-repo}/knative/configure-scaling-to-2m.yaml[configure-scaling-to-2m.yaml] | kubectl apply -f -
202-
----
203-
204-
.(OR)
205-
206-
[source,bash,subs="+macros,+attributes"]
207-
----
208-
oc -n knative-serving get cm config-autoscaler -o yaml | yq w - -s link:{github-repo}/{scaling-repo}/knative/configure-scaling-to-2m.yaml[configure-scaling-to-2m.yaml] | oc apply -f -
209-
----
210-
211-
Verifying the `scale-to-zero-grace-period` value, which should return `2m`:
212-
213-
[source,bash,subs="+macros,+attributes",linenums]
214-
----
215-
216-
kubectl -n knative-serving get configmap config-autoscaler -o yaml \
217-
| yq r - data.scale-to-zero-grace-period
218-
----
219-
220-
.(OR)
221-
222-
[source,bash,subs="+macros,+attributes",linenums]
223-
----
224-
oc -n knative-serving get configmap config-autoscaler -o yaml \
225-
| yq r - data.scale-to-zero-grace-period
226-
----
227-
228-
229-
Now <<scaling-invoke-service,firing the request>> to the greeter service will bring up the pod to serve the request and if we leave the service without any further requests, it will automatically scale to zero in `3 mins`(<<scale-to-zero-formulae,Compute scale to zero grace period>>).
199+
Now <<scaling-invoke-service,firing the request>> to the greeter service will bring up the pod to serve the request again. Leaving it without any further requests, it will automatically scale to zero in `2 mins`(<<scale-to-zero-formulae,Compute scale-to-zero grace period>>)
230200

231201
[#scaling-reset-to-defaults]
232-
=== Reset scale to zero to defaults
202+
=== Reset scale-to-zero to defaults
233203

234204
Let us revert the `scale-to-zero-grace-period` to its default:
235205

@@ -264,7 +234,7 @@ oc -n knative-serving get configmap config-autoscaler -o yaml \
264234
| yq r - data.scale-to-zero-grace-period
265235
----
266236

267-
For better clarity and understanding let us <<scaling-cleanup,clean up>> the deployed knative resources before going to next section.
237+
For better clarity and understanding let us <<scaling-cleanup,clean up>> the deployed Knative resources before going to next section.
268238

269239
[#scaling-auto-scaling]
270240
== Auto Scaling
@@ -340,11 +310,11 @@ watch oc get pods -n knativetutorial
340310
[#scaling-load-service]
341311
=== Load the service
342312

343-
We will now send some load to the greeter service. The command below sends 50 concurrent requests (`-c 50`) for the next 10s (`-z 10s`) and test will run for 30 seconds (`-t 30S`)
313+
We will now send some load to the greeter service. The command below sends 50 concurrent requests (`-c 50`) for the next 30s (`-t 30s`)
344314

345315
[source,bash,subs="+macros,+attributes",linenums]
346316
----
347-
siege -r 1 -c 50 -t 30S -d 2 \
317+
siege -r 1 -c 50 -t 30S \
348318
-H "Host: greeter.knativetutorial.example.com" \
349319
"http://pass:[${IP_ADDRESS}]"
350320
----

documentation/modules/ROOT/pages/05-build/build-templates.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ The raw builds like what we did in xref:ROOT:05-build/build.adoc[previous chapte
77
* Hard coding of build parameters
88
* Inability to make builds and services in synchronous i.e. services are deployed only after the related build is complete
99

10-
One of the solution to these problems is by using **Build Templates**.
10+
One of the solutions to these problems is **Build Templates**.
1111

12-
Like the build spec the knative build template spec and knative service spec also needs some customizations before apply them.
12+
Similarly to the build spec, the Knative build template spec and the Knative service spec needs some customizations before being applied.
1313

1414
[#build-template-prerequisite]
1515
== Prerequisite
@@ -279,4 +279,4 @@ oc -n knativetutorial delete services.serving.knative.dev event-greeter
279279
oc -n knativetutorial delete buildtemplates.build.knative.dev build-java-maven
280280
----
281281

282-
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you dont need them any more.
282+
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you don't need them anymore.

documentation/modules/ROOT/pages/05-build/build.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Its required that you have container registry account which is needed during the
1919
You can get one for free at https://hub.docker.com[Docker Hub]
2020
====
2121

22-
As the Knative build and build template spec needs some customizations,such as creating a secret with your container registry credentials; we need to run following commands to create the needed kubernetes and knative resources with all your customizations. All the generated files will be placed in `$TUTORIAL_HOME/04-build/knative`.
22+
As the Knative build and build template specs need some customizations, such as creating a secret with your container registry credentials; we need to run the following commands to create the needed kubernetes and Knative resources with all your customizations. All the generated files will be placed in `$TUTORIAL_HOME/04-build/knative`.
2323

2424
[#build-create-docker-secret]
2525
== Generate Docker Secret
@@ -72,11 +72,11 @@ type: kubernetes.io/basic-auth
7272
<2> The username to use when authenticating with https://index.docker.io/v1/
7373
<3> The password to use when authenticating with https://index.docker.io/v1/
7474

75-
For more details on why we need to do this please check https://github.com/knative/docs/blob/master/build/auth.md#basic-authentication-docker[here].
75+
For more details on why we need to do this please check https://github.com/knative/docs/blob/master/docs/build/auth.md#basic-authentication-docker[here].
7676

7777
[#build-generate-build-spec]
7878
== Generate Knative build spec
79-
The knative build spec is used to create and run the knative builds. You can find more details on Knative build https://github.com/knative/docs/tree/master/build[here].
79+
The Knative build spec is used to create and run the Knative builds. You can find more details on Knative build https://github.com/knative/docs/tree/master/docs/build[here].
8080

8181
[source,bash,subs="+macros,+attributes",linenums]
8282
----
@@ -222,8 +222,8 @@ oc apply -n knativetutorial -f link:{github-repo}/{build-repo}/knative/kaniko-pv
222222
----
223223

224224

225-
<1> The kubernetes secret called `basic-auth-pass`, check https://github.com/knative/docs/blob/master/build/auth.md#basic-authentication-docker[here] for more details
226-
<2> The kubernetes service account called `build-bot` that wll run the build. Only `build-bot` as access to the secret `basic-auth-pass`. Check https://github.com/knative/docs/blob/master/build/auth.md#basic-authentication-docker[here] for more details
225+
<1> The kubernetes secret called `basic-auth-pass`, check https://github.com/knative/docs/blob/master/docs/build/auth.md#basic-authentication-docker[here] for more details
226+
<2> The kubernetes service account called `build-bot` that will run the build. Only `build-bot` has access to the secret `basic-auth-pass`. Check https://github.com/knative/docs/blob/master/docs/build/auth.md#basic-authentication-docker[here] for more details
227227
<3> the kubernetes persistence volume claim used to cache maven artifacts, to make subsequent builds faster
228228
<4> the kubernetes persistence volume claim that will be used to cache docker base images to make subsequent https://github.com/GoogleContainerTools/kaniko[Kaniko] docker builds faster
229229

documentation/modules/ROOT/pages/06-eventing/eventing-src-sub.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ spec:
2222
name: in-memory-channel
2323
----
2424

25-
<1> The name of the channel, knative make it addressable i.e. resolveable to a target (a consumer service)
26-
<2> The channel provisioner which is responsible to provision this channel.Various messaging implementations provide their own channel(s) via __ClusterChannelProvisioner__.
25+
<1> The name of the channel. Knative makes it addressable, i.e. resolveable to a target (a consumer service)
26+
<2> The channel provisioner which is responsible for provisioning this channel. Various messaging implementations provide their own channel(s) via __ClusterChannelProvisioner__.
2727

2828
Navigate to tutorial chapter's `knative` folder:
2929

@@ -353,4 +353,4 @@ oc -n knativetutorial delete channels.eventing.knative.dev ch-event-greeter
353353
oc -n knativetutorial delete subscriptions.eventing.knative.dev event-greeter-subscriber
354354
----
355355

356-
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you dont need them any more.
356+
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you don't need them anymore.

documentation/modules/ROOT/pages/06-eventing/eventing-src-svc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Navigate to tutorial chapter's `templates` folder:
114114
cd $TUTORIAL_HOME/05-eventing/knative/templates
115115
----
116116

117-
Run the following command to create the knative service that will be used as the subscriber for the cron events:
117+
Run the following command to create the Knative service that will be used as the subscriber for the cron events:
118118

119119
[source,bash,subs="+macros,+attributes",linenums]
120120
----
@@ -213,4 +213,4 @@ oc -n knativetutorial delete \
213213
cronjobsources.sources.eventing.knative.dev event-greeter-cronjob-source
214214
----
215215

216-
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you dont need them any more.
216+
NOTE: You can also delete xref:ROOT:05-build/build.adoc#build-apply-prereq-resources[pre-req resources] that were created if you don't need them anymore.

0 commit comments

Comments
 (0)