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
This section covers additional advanced topics beyond the initial deployment.
205
+
192
206
### Use a private registry with Kubernetes
193
207
194
208
If you are using a hosted private Docker registry ([Docker Hub](https://hub.docker.com/), or other),
@@ -303,50 +317,35 @@ imagePullSecrets:
303
317
Save your changes.
304
318
OpenFaaS will now deploy functions with images in private repositories without having to specify the secret in the deployment manifests.
305
319
306
-
### Setting the ImagePullPolicy with OpenFaaS
320
+
### Set a custom ImagePullPolicy
307
321
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
322
+
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).
309
323
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
324
+
There are three options:
313
325
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
326
+
- `Always` - pull the Docker image from the registry every time a deployment changes
327
+
- `IfNotPresent` - only pull the image if it does not exist in the local registry cache
328
+
- `Never` - never attempt to pull an image
329
+
330
+
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.
331
+
332
+
If you're using helm you can pass a configuration flag:
If installing via a custom yaml manifest, ensure that your `faas-netes` contain spec includes
321
-
338
+
If you're using the plain YAML files then edit `gateway-dep.yml` and set the following for `faas-netes`:
322
339
```
323
-
env:
324
340
- name: image_pull_policy
325
341
value: "IfNotPresent"
326
342
```
327
343
328
-
[See here](/deployment/kubernetes/) for more details on deploying OpenFaaS in Kubernetes.
329
-
330
-
#### Which imagePullPolicy should you use
344
+
#### Notes on picking an "imagePullPolicy"
331
345
332
346
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
347
334
348
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
349
336
350
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
351
338
-
339
-
340
-
341
-
342
-
343
-
## Start the hands-on labs
344
-
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.
346
-
347
-
* [OpenFaaS workshop](/tutorials/workshop/)
348
-
## Troubleshooting
349
-
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