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
**What**
- Move the content on the image pull policy into the k8s deployment doc
- Remove the section numbers because they were out of order and manual
numbering is fragile
- Change the sectioning so that image pull secrets and image pull policy
belong to a new "Customizing the install" section
- Move the Use the UI so that it is nested under the "Deploy a function"
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
Copy file name to clipboardExpand all lines: docs/deployment/kubernetes.md
+46-9Lines changed: 46 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This guide is for deployment to a vanilla Kubernetes 1.8 or 1.9 cluster running
6
6
7
7
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
8
9
-
### 1.0 Build a cluster
9
+
### Build a cluster
10
10
11
11
You can start evaluating FaaS and building functions on your laptop or on a VM (cloud or on-prem).
12
12
@@ -27,11 +27,11 @@ We have a special guide for minikube here:
27
27
--user="$(gcloud config get-value core/account)"
28
28
```
29
29
30
-
### 1.1 Pick helm or YAML files for deployment
30
+
### Pick helm or YAML files for deployment
31
31
32
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`.
33
33
34
-
### 2.0a Deploy with Helm
34
+
### Deploy with Helm
35
35
36
36
A Helm chart is provided in the `faas-netes` repository. Follow the link below then come back to this guide.
37
37
@@ -41,7 +41,7 @@ To enable SSL while using Helm, try one of the following references:
41
41
42
42
-[Using nginx-ingress and cert-manager](/reference/ssl/kubernetes-with-cert-manager.md)
43
43
44
-
### 2.0b Deploy OpenFaaS
44
+
### Deploy OpenFaaS
45
45
46
46
This step assumes you are running `kubectl` on a master host.
47
47
@@ -74,7 +74,7 @@ This step assumes you are running `kubectl` on a master host.
74
74
!!! note
75
75
For deploying on a cloud that supports Kubernetes *LoadBalancers* you may also want to apply the configuration in: `cloud/lb.yml`.
76
76
77
-
### 3.0 Use OpenFaaS
77
+
### Use OpenFaaS
78
78
79
79
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).
If you are using a hosted private Docker registry ([Docker Hub](https://hub.docker.com/), or other),
194
195
in order to check how to configure it, please visit the Kubernetes [documentation](https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry).
@@ -302,12 +303,48 @@ imagePullSecrets:
302
303
Save your changes.
303
304
OpenFaaS will now deploy functions with images in private repositories without having to specify the secret in the deployment manifests.
304
305
305
-
## 3.1 Start the hands-on labs
306
+
### Setting the ImagePullPolicy with OpenFaaS
307
+
308
+
Kubernetes allows you to control the conditions for when Docker images are pulled onto a node via the [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images) config. Your options are
309
+
310
+
- `Always` : Kuberenetes will pull the Docker image from the registry every time
311
+
- `IfNotPresent` : Kuberentes will only pull the image if it does not exist in the local registry cache
312
+
- `Never` : Kuberenetes will never try to pull the image, you must manually ensure that the image already exists in the local cache
313
+
314
+
By default, deployed functions will use an `imagePullPolicy` of `Always`, which ensures functions using static image tags (e.g. "latest" tags) are refreshed during an update. This behavior is configurable in `faas-netes` via the `image_pull_policy` environment variable. When installing via helm you can easily set this value during install using
If installing via a custom yaml manifest, ensure that your `faas-netes` contain spec includes
321
+
322
+
```
323
+
env:
324
+
- name: image_pull_policy
325
+
value: "IfNotPresent"
326
+
```
327
+
328
+
[See here](/deployment/kubernetes/) for more details on deploying OpenFaaS in Kubernetes.
329
+
330
+
#### Which imagePullPolicy should you use
331
+
332
+
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.
333
+
334
+
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.
335
+
336
+
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.
337
+
338
+
339
+
340
+
341
+
342
+
343
+
## Start the hands-on labs
306
344
307
345
Learn how to build serverless functions with OpenFaaS and Python in our half-day workshop. You can follow along online at your own pace.
308
346
309
347
* [OpenFaaS workshop](/tutorials/workshop/)
310
-
311
348
## Troubleshooting
312
349
313
350
If you are running into any issues please check out the troubleshooting guide and search the documentation / past issues before raising an issue.
0 commit comments