Skip to content

Commit 3fc58fe

Browse files
LucasRoesleralexellis
authored andcommitted
Move imagepullpolicy into k8s deployment docs
**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>
1 parent a98271f commit 3fc58fe

3 files changed

Lines changed: 46 additions & 41 deletions

File tree

docs/deployment/kubernetes.md

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This guide is for deployment to a vanilla Kubernetes 1.8 or 1.9 cluster running
66

77
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).
88

9-
### 1.0 Build a cluster
9+
### Build a cluster
1010

1111
You can start evaluating FaaS and building functions on your laptop or on a VM (cloud or on-prem).
1212

@@ -27,11 +27,11 @@ We have a special guide for minikube here:
2727
--user="$(gcloud config get-value core/account)"
2828
```
2929

30-
### 1.1 Pick helm or YAML files for deployment
30+
### Pick helm or YAML files for deployment
3131

3232
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`.
3333

34-
### 2.0a Deploy with Helm
34+
### Deploy with Helm
3535

3636
A Helm chart is provided in the `faas-netes` repository. Follow the link below then come back to this guide.
3737

@@ -41,7 +41,7 @@ To enable SSL while using Helm, try one of the following references:
4141

4242
- [Using nginx-ingress and cert-manager](/reference/ssl/kubernetes-with-cert-manager.md)
4343

44-
### 2.0b Deploy OpenFaaS
44+
### Deploy OpenFaaS
4545

4646
This step assumes you are running `kubectl` on a master host.
4747

@@ -74,7 +74,7 @@ This step assumes you are running `kubectl` on a master host.
7474
!!! note
7575
For deploying on a cloud that supports Kubernetes *LoadBalancers* you may also want to apply the configuration in: `cloud/lb.yml`.
7676

77-
### 3.0 Use OpenFaaS
77+
### Use OpenFaaS
7878

7979
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).
8080

@@ -164,7 +164,7 @@ c6ee9e33cf5c6715a1d148fd73f7318884b41adcb916021e2bc0e800a5c5dd97f5142178f6ae88c8
164164
165165
[Your first serverless Python function with OpenFaaS](https://blog.alexellis.io/first-faas-python-function/)
166166
167-
## Use the UI
167+
### Use the UI
168168
169169
The UI is exposed on NodePort 31112.
170170
@@ -188,7 +188,8 @@ $ echo -n "" | faas-cli invoke --gateway http://kubernetes-ip:31112 nodeinfo
188188
$ echo -n "verbose" | faas-cli invoke --gateway http://kubernetes-ip:31112 nodeinfo
189189
```
190190
191-
### 4.0 Use a private registry with Kubernetes
191+
## Customizing the install
192+
### Use a private registry with Kubernetes
192193
193194
If you are using a hosted private Docker registry ([Docker Hub](https://hub.docker.com/), or other),
194195
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:
302303
Save your changes.
303304
OpenFaaS will now deploy functions with images in private repositories without having to specify the secret in the deployment manifests.
304305
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
315+
316+
```
317+
helm upgrade openfaas openfaas/openfaas --install --set "faasnetesd.imagePullPolicy=IfNotPresent"
318+
```
319+
320+
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
306344
307345
Learn how to build serverless functions with OpenFaaS and Python in our half-day workshop. You can follow along online at your own pace.
308346
309347
* [OpenFaaS workshop](/tutorials/workshop/)
310-
311348
## Troubleshooting
312349
313350
If you are running into any issues please check out the troubleshooting guide and search the documentation / past issues before raising an issue.

docs/reference/image-pull-policy.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

mkdocs.yml

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

0 commit comments

Comments
 (0)