Skip to content

Commit a98271f

Browse files
LucasRoesleralexellis
authored andcommitted
Add documentation describing the imagePullPolicy
**What** - Adds a reference page for the `faas-netes` image pull policy configuration Closes #14 Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
1 parent c22b9e2 commit a98271f

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Using Kuberenetes ImagePullPolicy with OpenFaaS
2+
3+
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
4+
5+
- `Always` : Kuberenetes will pull the Docker image from the registry every time
6+
- `IfNotPresent` : Kuberentes will only pull the image if it does not exist in the local registry cache
7+
- `Never` : Kuberenetes will never try to pull the image, you must manually ensure that the image already exists in the local cache
8+
9+
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
10+
11+
```
12+
helm upgrade openfaas openfaas/openfaas --install --set "faasnetesd.imagePullPolicy=IfNotPresent"
13+
```
14+
15+
If installing via a custom yaml manifest, ensure that your `faas-netes` contain spec includes
16+
17+
```
18+
env:
19+
- name: image_pull_policy
20+
value: "IfNotPresent"
21+
```
22+
23+
[See here](/deployment/kubernetes/) for more details on deploying OpenFaaS in Kubernetes.
24+
25+
## Which imagePullPolicy should you use
26+
27+
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.
28+
29+
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.
30+
31+
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.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ nav:
133133
- Triggers: ./reference/triggers.md
134134
- Workloads: ./reference/workloads.md
135135
- YAML: ./reference/yaml.md
136+
- ImagePullPolicy: ./reference/image-pull-policy.md
136137
- Design & Architecture:
137138
- Gateway: ./architecture/gateway.md
138139
- Watchdog: ./architecture/watchdog.md

0 commit comments

Comments
 (0)