Skip to content

Commit 6b54bfb

Browse files
kadern0alexellis
authored andcommitted
Removed Docker Swarm references
Signed-off-by: Pablo Caderno <[email protected]>
1 parent 74f50f4 commit 6b54bfb

File tree

9 files changed

+8
-128
lines changed

9 files changed

+8
-128
lines changed

lab1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ export OPENFAAS_PREFIX="" # Populate with your Docker Hub username
9292

9393
### Setup a single-node cluster
9494

95-
The labs use Kubernetes, and still have some references to Docker Swarm. Please ignore those references as Swarm is no longer supported by the OpenFaaS community. Some of the workshop labs will work for faasd, but you may need to alter the commands and we do not provide support for the workshop when taken with faasd.
95+
The labs use Kubernetes, Swarm is no longer supported by the OpenFaaS community. Some of the workshop labs will work for faasd, but you may need to alter the commands and we do not provide support for the workshop when taken with faasd.
9696

9797
* Kubernetes: [Lab 1b](./lab1b.md)

lab10.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ This is a more secure alternative to environmental variables. Environmental vari
2424
2525
From a terminal run the following command:
2626

27-
#### _Docker Swarm_
28-
29-
```
30-
$ echo -n <auth_token> | faas-cli secret create auth-token
31-
```
32-
33-
#### _Kubernetes_
34-
3527
```
3628
$ echo -n <auth_token> | faas-cli secret create auth-token
3729
```
@@ -43,8 +35,6 @@ $ faas-cli secret ls
4335
```
4436
> Note: Remember that the `-g` flag enables easy switching between gateways. This works for secrets too.
4537
46-
#### _Kubernetes_
47-
4838
```
4939
kubectl get secret auth-token -n openfaas-fn -o json
5040
```
@@ -69,18 +59,13 @@ functions:
6959
image: <your-username>/issue-bot
7060
environment:
7161
write_debug: true
72-
gateway_hostname: "gateway"
62+
gateway_hostname: "gateway.openfaas"
7363
positive_threshold: 0.25
7464
secrets:
7565
- auth-token
7666

7767
```
7868

79-
> Note: If you're running on Kubernetes, suffix the `gateway_hostname` with `openfaas` namespace:
80-
> ```
81-
> gateway_hostname: "gateway.openfaas"
82-
> ```
83-
8469
### Update the `issue-bot` function
8570

8671
The function handler requires changing in order to cause it to read the `auth-token` secret, rather than the environment variable. This is a single line change where:

lab2.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,6 @@ $ cat lab2.md | faas-cli invoke markdown
139139

140140
OpenFaaS tracks metrics on your functions automatically using Prometheus. The metrics can be turned into a useful dashboard with free and Open Source tools like [Grafana](https://grafana.com).
141141

142-
Deploy OpenFaaS Grafana with:
143-
144-
#### _Docker Swarm_
145-
146-
```bash
147-
$ docker service create -d \
148-
--name=grafana \
149-
--publish=3000:3000 \
150-
--network=func_functions \
151-
stefanprodan/faas-grafana:4.6.3
152-
```
153-
154-
#### _Kubernetes_
155-
156142
Run Grafana in OpenFaaS Kubernetes namespace:
157143

158144
```sh
@@ -186,16 +172,7 @@ $ kubectl port-forward pod/grafana 3000:3000 -n openfaas
186172

187173
If you're using Kubernetes 1.17 or older, use `deploy/grafana` instead of `pod/` in the command above.
188174

189-
After the service has been created open Grafana in your browser, login with username `admin` password `admin` and navigate to the pre-made OpenFaaS dashboard at:
190-
191-
192-
#### _Docker Swarm_
193-
194-
[http://127.0.0.1:3000/dashboard/db/openfaas](http://127.0.0.1:3000/dashboard/db/openfaas)
195-
196-
#### _Kubernetes_
197-
198-
Use `$GRAFANA_URL` instead
175+
After the service has been created open Grafana in your browser, login with username `admin` password `admin` and navigate to the pre-made OpenFaaS dashboard at `$GRAFANA_URL`.
199176

200177
<a href="https://camo.githubusercontent.com/24915ac87ecf8a31285f273846e7a5ffe82eeceb/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f4339636145364358554141585f36342e6a70673a6c61726765"><img src="https://camo.githubusercontent.com/24915ac87ecf8a31285f273846e7a5ffe82eeceb/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f4339636145364358554141585f36342e6a70673a6c61726765" width="600px" /></a>
201178

lab3.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,6 @@ Joe Acaba is in space
257257

258258
You can find out high-level information on every invocation of your function via the container's logs:
259259

260-
#### _Docker Swarm_
261-
262-
```sh
263-
$ docker service logs -f astronaut-finder
264-
astronaut-finder.1.1e1ujtsijf6b@nuc | 2018/02/21 14:53:25 Forking fprocess.
265-
astronaut-finder.1.1e1ujtsijf6b@nuc | 2018/02/21 14:53:26 Wrote 18 Bytes - Duration: 0.063269 seconds
266-
```
267-
268-
#### _Kubernetes_
269-
270260
```sh
271261
$ kubectl logs deployment/astronaut-finder -n openfaas-fn
272262
```
@@ -304,18 +294,6 @@ Now deploy your function again with `faas-cli deploy -f ./astronaut-finder.yml`.
304294

305295
Invoke the function and then checkout the logs again to view the function responses:
306296

307-
#### _Docker Swarm_
308-
```sh
309-
$ docker service logs -f astronaut-finder
310-
311-
astronaut-finder.1.tp6k14i8kf6s | 2019/04/25 18:28:36 Forking fprocess.
312-
astronaut-finder.1.tp6k14i8kf6s | 2019/04/25 18:28:36 Query
313-
astronaut-finder.1.tp6k14i8kf6s | 2019/04/25 18:28:36 Path /
314-
astronaut-finder.1.tp6k14i8kf6s | 2019/04/25 18:28:37 Duration: 1.128897 seconds
315-
astronaut-finder.1.tp6k14i8kf6s | Alexey Ovchinin is in space
316-
```
317-
318-
#### _Kubernetes_
319297
```sh
320298
$ kubectl logs deployment/astronaut-finder -n openfaas-fn
321299
```

lab4.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ Let's try it out with a querystring and a function that lists off all environmen
3131

3232
* Deploy a function that prints environmental variables using a built-in BusyBox command:
3333

34-
#### _Docker Swarm_
35-
36-
```
37-
$ faas-cli deploy --name env --fprocess="env" --image="functions/alpine:latest" --network=func_functions
38-
```
39-
40-
#### _Kubernetes_
41-
4234
```
4335
$ faas-cli deploy --name env --fprocess="env" --image="functions/alpine:latest"
4436
```
@@ -372,15 +364,6 @@ So the result shows us that our test sentence was both very subjective (75%) and
372364

373365
The following code can be used to call the *Sentiment Analysis* function or any other function:
374366

375-
#### _Docker Swarm_
376-
377-
```python
378-
test_sentence = "California is great, it's always sunny there."
379-
r = requests.get("http://gateway:8080/function/sentimentanalysis", data= test_sentence)
380-
```
381-
382-
#### _Kubernetes_
383-
384367
Suffix the gateway host with `openfaas` namespace:
385368
```python
386369
r = requests.get("http://gateway.openfaas:8080/function/sentimentanalysis", text= test_sentence)

lab5.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ You will need to receive incoming webhooks from GitHub. In production you will h
2929

3030
Open a new Terminal and type in:
3131

32-
### _Docker Swarm_
33-
34-
```
35-
$ docker run -p 4040:4040 -d --name=ngrok --net=func_functions \
36-
alexellis2/ngrok-admin http gateway:8080
37-
```
38-
39-
#### _Kubernetes_
40-
4132
```
4233
$ kubectl -n openfaas run \
4334
--image=alexellis2/ngrok-admin \
@@ -201,11 +192,11 @@ Update your `requirements.txt` file with the requests module for HTTP/HTTPs:
201192
requests
202193
```
203194

204-
Add `gateway_hostname` environment variable to `issue-bot.yml` file and set its value to `gateway` for Swarm or `gateway.openfaas` for Kubernetes.
195+
Add `gateway_hostname` environment variable to `issue-bot.yml` file and set its value to `gateway.openfaas`.
205196
```
206197
...
207198
environment:
208-
gateway_hostname: "gateway"
199+
gateway_hostname: "gateway.openfaas"
209200
...
210201
```
211202

@@ -269,17 +260,11 @@ functions:
269260
image: <your-username>/issue-bot
270261
environment:
271262
write_debug: true
272-
gateway_hostname: "gateway"
263+
gateway_hostname: "gateway.openfaas"
273264
positive_threshold: 0.25
274265
environment_file:
275266
- env.yml
276267
```
277-
278-
> Note: If you're running on Kubernetes, suffix the `gateway_hostname` with `openfaas` namespace:
279-
> ```
280-
> gateway_hostname: "gateway.openfaas"
281-
> ```
282-
283268
> The `positive_threshold` environmental variable is used to fine-tune whether an Issue gets the `positive` or `review` label.
284269

285270
Any sensitive information is placed in an external file (i.e. `env.yml`) so that it can be included in a `.gitignore` file which will help prevent that information getting stored in a public Git repository.

lab7.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ Asynchronous function calls are well-suited to tasks where you can defer the exe
7474

7575
The default stack for OpenFaaS uses NATS Streaming for queueing and deferred execution. You can view the logs with the following command:
7676

77-
#### _Docker Swarm_
78-
79-
```
80-
docker service logs -f func_queue-worker
81-
```
82-
83-
#### _Kubernetes_
84-
8577
```
8678
kubectl logs deployment/queue-worker -n openfaas
8779
```

lab8.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ Finished the sleep
8686
8787
There is also a maximum timeout duration set at the gateway and it will override the function timeout. At the time of writing the maximum timeout is configured at "20s", but can be configured to a longer or shorter value.
8888
89-
#### _Docker Swarm_
90-
To update the gateway value, set `read_timeout` and `write_timeout` in the `docker-compose.yml` file for the `gateway` and `faas-swarm` service then run `./deploy_stack.sh`.
91-
92-
#### _Kubernetes_
9389
To update the gateway value, set `gateway.readTimeout` and `gateway.writeTimeout` in the [values.yaml](https://github.com/openfaas/faas-netes/blob/master/chart/openfaas/values.yaml) file or use the Helm parameters `--set gateway.readTimeout=value` and `--set gateway.writeTimeout=value`.
9490
9591
Now move onto [Lab 9](lab9.md)

lab9.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ You can control the maximum amount of replicas that can spawn for a function by
2828
2929
### Check out Prometheus
3030

31-
Open Prometheus in a web-browser:
32-
33-
#### _Docker Swarm_
34-
35-
`http://127.0.0.1:9090/graph`
36-
37-
#### _Kubernetes_
38-
3931
You will need to run this port-forwarding command in order to be able to access Prometheus on `http://127.0.0.1:9090`:
4032
```
4133
$ kubectl port-forward deployment/prometheus 9090:9090 -n openfaas
@@ -160,21 +152,13 @@ See also: [hey on GitHub](https://github.com/rakyll/hey)
160152

161153
If you scale down your function to 0 replicas, you can still invoke it. The invocation will trigger the gateway into scaling the function to a non-zero value.
162154

163-
Try it out with the following commands:
155+
Try it out with the following command:
164156

165-
Docker Swarm:
166-
```
167-
$ docker service scale nodeinfo=0
168-
```
169-
170-
Kubernetes:
171157
```
172158
$ kubectl scale deployment --replicas=0 nodeinfo -n openfaas-fn
173159
```
174160

175-
Open the OpenFaaS UI and check that nodeinfo has 0 replicas, or by `docker service ls | grep nodeinfo`.
176-
177-
> For Kubernetes use `kubectl get deployment nodeinfo -n openfaas-fn`
161+
Open the OpenFaaS UI and check that nodeinfo has 0 replicas, or by `kubectl get deployment nodeinfo -n openfaas-fn`.
178162

179163
Now invoke the function and check back that it scaled to 1 replicas.
180164

0 commit comments

Comments
 (0)