You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deployment/kubernetes.md
+24-23Lines changed: 24 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,9 @@
2
2
3
3
This guide is for deployment to a vanilla Kubernetes 1.8 or 1.9 cluster running on Linux hosts. It is not a hand-book, please see the set of guides and blogs posts available at [openfaas/guide](https://github.com/openfaas/faas/tree/master/guide).
4
4
5
-
## Kubernetes
6
-
7
5
OpenFaaS is Kubernetes-native and uses *Deployments*, *Services* and *Secrets*. For more detail check out the ["faas-netes" repository](https://github.com/openfaas/faas-netes).
8
6
9
-
###Build a cluster
7
+
## Build a cluster
10
8
11
9
You can start evaluating FaaS and building functions on your laptop or on a VM (cloud or on-prem).
12
10
@@ -29,9 +27,13 @@ We have a special guide for minikube here:
29
27
30
28
### Pick helm or YAML files for deployment
31
29
32
-
If you'd like to use helm follow the instructions in 2.0a and then come back here, otherwise follow 2.0b to use plain `kubectl`.
30
+
It is recommended to use `helm` to install OpenFaaS so that you can configure your installation to suit your needs. This configuration is considered to be production-ready.
31
+
32
+
If you have issues using `helm` in a locked-down environment then you can still use the `helm template` command to generate a custom set of YAML to apply using `kubectl`.
33
33
34
-
### Deploy with Helm
34
+
Plain YAML files are also provided for x86_64 and armhf, but since they cannot be customized easily it is recommended that you only use these for local development.
35
+
36
+
#### Deploy with Helm
35
37
36
38
A Helm chart is provided in the `faas-netes` repository. Follow the link below then come back to this guide.
37
39
@@ -41,7 +43,7 @@ To enable SSL while using Helm, try one of the following references:
41
43
42
44
-[Using nginx-ingress and cert-manager](/reference/ssl/kubernetes-with-cert-manager.md)
43
45
44
-
### Deploy OpenFaaS
46
+
####Deploy OpenFaaS
45
47
46
48
This step assumes you are running `kubectl` on a master host.
47
49
@@ -74,15 +76,15 @@ This step assumes you are running `kubectl` on a master host.
74
76
!!! note
75
77
For deploying on a cloud that supports Kubernetes *LoadBalancers* you may also want to apply the configuration in: `cloud/lb.yml`.
76
78
77
-
### Use OpenFaaS
79
+
#### Use OpenFaaS
78
80
79
81
After deploying OpenFaaS you can start using one of the guides or blog posts to create Serverless functions or test [community functions](https://github.com/openfaas/faas/blob/master/community.md).
You can also watch a complete walk-through of OpenFaaS on Kubernetes which demonstrates auto-scaling in action and how to use the Prometheus UI. [Video walk-through](https://www.youtube.com/watch?v=0DbrLsUvaso).
84
86
85
-
## Deploy a function
87
+
### Deploy a function
86
88
87
89
For simplicity the default configuration uses NodePorts rather than an IngressController (which is more complicated to setup).
88
90
@@ -98,7 +100,7 @@ For simplicity the default configuration uses NodePorts rather than an IngressCo
98
100
99
101
There are currently no sample functions built into this stack, but we can deploy them quickly via the UI or FaaS-CLI.
100
102
101
-
### Use the CLI
103
+
#### Use the CLI
102
104
103
105
* Install the CLI
104
106
@@ -137,7 +139,7 @@ There are currently no sample functions built into this stack, but we can deploy
This section covers additional advanced topics beyond the initial deployment.
205
207
206
-
### Use a private registry with Kubernetes
208
+
#### Use a private registry with Kubernetes
207
209
208
210
If you are using a hosted private Docker registry ([Docker Hub](https://hub.docker.com/), or other),
209
211
in order to check how to configure it, please visit the Kubernetes [documentation](https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry).
210
212
211
-
#### Deploy a function from a private Docker image
213
+
##### Deploy a function from a private Docker image
212
214
213
215
With the following commands you can deploy a function from a private Docker image, tag and push it to your docker registry account:
214
216
@@ -232,7 +234,7 @@ In your favorite editor, open stack.yaml and add
232
234
```yml
233
235
provider:
234
236
name: faas
235
-
gateway: http://localhost:8080
237
+
gateway: http://127.0.0.1:8080
236
238
237
239
functions:
238
240
protectedapi:
@@ -241,7 +243,7 @@ functions:
241
243
image: username/private-alpine:latest
242
244
```
243
245
244
-
#### Create an image pull secret
246
+
##### Create an image pull secret
245
247
246
248
If you try to deploy using `faas-cli deploy` it will fail because Kubernetes can not pull the image. You can verify this in the Kubernetes dashboard or via the CLI using the `kubectl describe` command.
247
249
@@ -276,7 +278,7 @@ This is a `stack.yml` example with the secret added in it:
276
278
```yml
277
279
provider:
278
280
name: faas
279
-
gateway: http://localhost:8080
281
+
gateway: http://127.0.0.1:8080
280
282
281
283
functions:
282
284
protectedapi:
@@ -289,7 +291,7 @@ This is a `stack.yml` example with the secret added in it:
289
291
290
292
You can deploy your function using `faas-cli deploy`. If you inspect the Kubernetes pods, you will see that it can pull the docker image.
291
293
292
-
#### Link the image pull secret to a namespace service account
294
+
##### Link the image pull secret to a namespace service account
293
295
294
296
Instead of always editing the function .yml you can link your private Docker repository secret to the Kubernetes namespace service account manifest. This will auto add the `imagePullSecret` property to any deployment/pod manifest refrencing an image in that particular private repo.
295
297
@@ -317,7 +319,7 @@ imagePullSecrets:
317
319
Save your changes.
318
320
OpenFaaS will now deploy functions with images in private repositories without having to specify the secret in the deployment manifests.
319
321
320
-
### Set a custom ImagePullPolicy
322
+
#### Set a custom ImagePullPolicy
321
323
322
324
Kubernetes allows you to control the conditions for when the Docker images for your functions are pulled onto a node. This is configured through an [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images).
323
325
@@ -341,11 +343,10 @@ If you're using the plain YAML files then edit `gateway-dep.yml` and set the fol
341
343
value: "IfNotPresent"
342
344
```
343
345
344
-
#### Notes on picking an "imagePullPolicy"
346
+
##### Notes on picking an "imagePullPolicy"
345
347
346
348
As mentioned above, the default value is `Always`. Every time a function is deployed or is scaled up, Kubernetes will pull a potentially updated copy of the image from the registry. If you are using static image tags like `latest`, this is necessary.
347
349
348
350
When set to `IfNotPresent`, function deployments may not be updated when using static image tags like `latest`. `IfNotPresent` is particularly useful when developing locally with minikube. In this case, you can set your local environment to use [minikube's docker](https://github.com/kubernetes/minikube/blob/master/docs/reusing_the_docker_daemon.md) so `faas-cli build` builds directly into minikube's image store. `faas-cli push` is unnecessary in this workflow - use faas-cli build then faas-cli deploy.
349
351
350
352
When set to `Never`, only local (or pulled) images will work. This is useful if you want to tightly control which images are available and run in your Kubernetes cluster.
0 commit comments