Skip to content

Commit 97c42cc

Browse files
committedAug 16, 2020
Address PR review comments
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
1 parent ed863d7 commit 97c42cc

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed
 

‎_posts/2020-07-08-event-driven-functions-with-openfaas-and-nats.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,31 @@ There are several other connectors which allows you to trigger OpenFaaS function
2828

2929
![NATS Publish Subscribe](/images/2020-openfaas-nats/nats-publish-subscribe.png "https://docs.nats.io/nats-concepts/pubsub")
3030

31-
## Pre-requisite Installation
31+
## Prerequisites
3232

33-
* [k3d](https://github.com/rancher/k3d) to create a [k3s](https://github.com/rancher/k3s) cluster. k3s is lightweight distribution of kubernetes from Rancher Labs.
34-
* [arkade](https://github.com/alexellis/arkade) to install OpenFaaS, nats-connector, kubectl and faas-cl. `arkade` is simple CLI tool to install helm charts and apps to your cluster in one command.
33+
Before we start we need a couple of tools to help us quickly set up our environment:
34+
35+
* [docker](https://docs.docker.com/get-docker/) - required to use KinD
36+
* [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) - a tool for running local Kubernetes clusters using Docker
37+
* [arkade](https://github.com/alexellis/arkade) - official installer for OpenFaaS, that supports many other applications for Kubernetes
3538

3639
> Please make sure you have these tools installed before you proceed next.
3740
3841
## Install Components
3942

40-
#### Create a kubernetes cluster
43+
#### Create cluster
4144

42-
`k3d` is a tool to run `k3s` in docker. Create a single node `k3s` cluster. You can also use other tools like [KinD](https://github.com/kubernetes-sigs/kind)
45+
First thing we need is running Kubernetes cluster:
4346

44-
```
45-
k3d create
47+
```bash
48+
kind create cluster
4649
```
4750

48-
Follow instructions returned in the output of this command to configure KUBECONFIG to access the cluster using kubectl.
51+
Wait for the installation to finish run this command to verify that the cluster is ready:
52+
53+
```bash
54+
kubectl -n kube-system rollout status deployment/coredns
55+
```
4956

5057
#### Install OpenFaaS
5158
Install OpenFaaS using `arkade`
@@ -103,20 +110,13 @@ echo -n $PASSWORD | faas-cli login --username admin --password-stdin
103110

104111
`publish-message` function publishes message to nats-test topic.
105112

106-
Deploy `receive-message` function
107-
108-
```
109-
faas-cli deploy --name receive-message --image openfaas/receive-message:latest \
110-
--fprocess='./handler' --annotation topic="nats-test"
111-
```
113+
Deploy functions
112114

113-
Deploy `publish-message` function
114115
```
115-
faas-cli deploy --name publish-message --image openfaas/publish-message:latest \
116-
--fprocess='./handler' --env nats_url=nats://nats.openfaas:4222
116+
faas-cli deploy -f https://raw.githubusercontent.com/openfaas-incubator/nats-connector/master/contrib/test-functions/stack.yml --read-template=false
117117
```
118118

119-
> Note: You can also build and deploy this function using the stack.yml and code present in nats-connector repository. But for simplicity, I am using pre built and published images of these functions.
119+
> Note: You can also build and deploy this function using the stack.yml and code present in nats-connector repository.
120120
121121
## Verify the installation
122122
Invoke `publish-message` function to publish a test message
@@ -143,7 +143,7 @@ faas-cli logs receive-message
143143
```
144144

145145
## What Next ?
146-
* Do you have a cool "event driven" use case you want to share? Let us know and become a guest blogger!
146+
* Do you have a cool "event-driven" use case you want to share? Let us know and become a guest blogger!
147147

148148
* If you are new to OpenFaaS, I would recommend you trying [OpenFaaS workshop](https://github.com/openfaas/workshop) .
149149

0 commit comments

Comments
 (0)
Failed to load comments.