kandi background
kandi background
Explore Kits
kandi background
Explore Kits
Explore all Prometheus open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Prometheus

v1.34.1

8.5.0 (2022-04-21)

2.35.0-rc1 / 2022-04-14

Export new metrics for OpenFaaS Pro scaling (fixed build)

9.0.0

netdata

v1.34.1

grafana

8.5.0 (2022-04-21)

prometheus

2.35.0-rc1 / 2022-04-14

faas

Export new metrics for OpenFaaS Pro scaling (fixed build)

skywalking

9.0.0

Popular Libraries in Prometheus

Trending New libraries in Prometheus

Top Authors in Prometheus

1

42 Libraries

466

2

25 Libraries

71434

3

25 Libraries

67872

4

19 Libraries

3930

5

18 Libraries

5062

6

15 Libraries

356

7

15 Libraries

296

8

14 Libraries

180

9

13 Libraries

624

10

11 Libraries

5124

1

42 Libraries

466

2

25 Libraries

71434

3

25 Libraries

67872

4

19 Libraries

3930

5

18 Libraries

5062

6

15 Libraries

356

7

15 Libraries

296

8

14 Libraries

180

9

13 Libraries

624

10

11 Libraries

5124

Trending Kits in Prometheus

No Trending Kits are available at this moment for Prometheus

Trending Discussions on Prometheus

    Enable use of images from the local library on Kubernetes
    Add Kubernetes scrape target to Prometheus instance that is NOT in Kubernetes
    Prometheus cannot scrape from spring-boot application over HTTPS
    Apply yaml file using k8s SDK
    Content of go.sum and modules really used by a go application
    Is Google Managed Prometheus billing per million or per billion?
    Filter the parts of a Request Path which match against a Static Segment in Servant
    Can't deploy streamlit app on share.streamlit.io
    OAUTH2 user service with Custom Authentication Providers
    Prometheus kubelet metrics with pod labels

QUESTION

Enable use of images from the local library on Kubernetes

Asked 2022-Mar-20 at 13:23

I'm following a tutorial https://docs.openfaas.com/tutorials/first-python-function/,

currently, I have the right image

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9

there is a step that forewarns me to do some setup(My case is I'm using Kubernetes and minikube and don't want to push to a remote container registry, I should enable the use of images from the local library on Kubernetes.), I see the hints

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10

I'm not sure how to configure it correctly. the final result indicates I failed.

Unsurprisingly, I couldn't access the function service, I find some clues in https://docs.openfaas.com/deployment/troubleshooting/#openfaas-didnt-start which might help to diagnose the problem.

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50

hello-openfaas.yml

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60

I create a new project hello-openfaas2 to reproduce this error

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60$ faas-cli new --lang python3 hello-openfaas2 --prefix="wm"
61Folder: hello-openfaas2 created.
62# I add `imagePullPolicy: Never` to `hello-openfaas2.yml`
63$ faas-cli build -f ./hello-openfaas2.yml 
64$ faas-cli deploy -f ./hello-openfaas2.yml 
65Deploying: hello-openfaas2.
66WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
67
68Deployed. 202 Accepted.
69URL: http://192.168.1.3:8099/function/hello-openfaas2
70
71
72$ kubectl logs -n openfaas-fn deploy/hello-openfaas2
73Error from server (BadRequest): container "hello-openfaas2" in pod "hello-openfaas2-7c67488865-7d7vm" is waiting to start: image can't be pulled
74
75$ kubectl get pods --all-namespaces
76NAMESPACE              NAME                                        READY   STATUS             RESTARTS         AGE
77kube-system            coredns-64897985d-kp7vf                     1/1     Running            0                47h
78...
79openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0                4h28m
80openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0                18h
81openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0                127m
82openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0                165m
83openfaas-fn            hello-openfaas2-7c67488865-qmrkl            0/1     ImagePullBackOff   0                13m
84openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0                97m
85openfaas-fn            hello-python-554b464498-zxcdv               0/1     ErrImagePull       0                3h23m
86openfaas-fn            hello-python-8698bc68bd-62gh9               0/1     ImagePullBackOff   0                3h25m
87

from https://docs.openfaas.com/reference/yaml/, I know I put the imagePullPolicy in the wrong place, there is no such keyword in its schema.

I also tried eval $(minikube docker-env and still get the same error.


I've a feeling that faas-cli deploy can be replace by helm, they all mean to run the image(whether from remote or local) in Kubernetes cluster, then I can use helm chart to setup the pullPolicy there. Even though the detail is not still clear to me, This discovery inspires me.


So far, after eval $(minikube docker-env)

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60$ faas-cli new --lang python3 hello-openfaas2 --prefix="wm"
61Folder: hello-openfaas2 created.
62# I add `imagePullPolicy: Never` to `hello-openfaas2.yml`
63$ faas-cli build -f ./hello-openfaas2.yml 
64$ faas-cli deploy -f ./hello-openfaas2.yml 
65Deploying: hello-openfaas2.
66WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
67
68Deployed. 202 Accepted.
69URL: http://192.168.1.3:8099/function/hello-openfaas2
70
71
72$ kubectl logs -n openfaas-fn deploy/hello-openfaas2
73Error from server (BadRequest): container "hello-openfaas2" in pod "hello-openfaas2-7c67488865-7d7vm" is waiting to start: image can't be pulled
74
75$ kubectl get pods --all-namespaces
76NAMESPACE              NAME                                        READY   STATUS             RESTARTS         AGE
77kube-system            coredns-64897985d-kp7vf                     1/1     Running            0                47h
78...
79openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0                4h28m
80openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0                18h
81openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0                127m
82openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0                165m
83openfaas-fn            hello-openfaas2-7c67488865-qmrkl            0/1     ImagePullBackOff   0                13m
84openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0                97m
85openfaas-fn            hello-python-554b464498-zxcdv               0/1     ErrImagePull       0                3h23m
86openfaas-fn            hello-python-8698bc68bd-62gh9               0/1     ImagePullBackOff   0                3h25m
87$ docker images
88REPOSITORY                                TAG        IMAGE ID       CREATED             SIZE
89wm/hello-openfaas2                        0.1        03c21bd96d5e   About an hour ago   65.2MB
90python                                    3-alpine   69fba17b9bae   12 days ago         48.6MB
91ghcr.io/openfaas/figlet                   latest     ca5eef0de441   2 weeks ago         14.8MB
92ghcr.io/openfaas/alpine                   latest     35f3d4be6bb8   2 weeks ago         14.2MB
93ghcr.io/openfaas/faas-netes               0.14.2     524b510505ec   3 weeks ago         77.3MB
94k8s.gcr.io/kube-apiserver                 v1.23.3    f40be0088a83   7 weeks ago         135MB
95k8s.gcr.io/kube-controller-manager        v1.23.3    b07520cd7ab7   7 weeks ago         125MB
96k8s.gcr.io/kube-scheduler                 v1.23.3    99a3486be4f2   7 weeks ago         53.5MB
97k8s.gcr.io/kube-proxy                     v1.23.3    9b7cc9982109   7 weeks ago         112MB
98ghcr.io/openfaas/gateway                  0.21.3     ab4851262cd1   7 weeks ago         30.6MB
99ghcr.io/openfaas/basic-auth               0.21.3     16e7168a17a3   7 weeks ago         14.3MB
100k8s.gcr.io/etcd                           3.5.1-0    25f8c7f3da61   4 months ago        293MB
101ghcr.io/openfaas/classic-watchdog         0.2.0      6f97aa96da81   4 months ago        8.18MB
102k8s.gcr.io/coredns/coredns                v1.8.6     a4ca41631cc7   5 months ago        46.8MB
103k8s.gcr.io/pause                          3.6        6270bb605e12   6 months ago        683kB
104ghcr.io/openfaas/queue-worker             0.12.2     56e7216201bc   7 months ago        7.97MB
105kubernetesui/dashboard                    v2.3.1     e1482a24335a   9 months ago        220MB
106kubernetesui/metrics-scraper              v1.0.7     7801cfc6d5c0   9 months ago        34.4MB
107nats-streaming                            0.22.0     12f2d32e0c9a   9 months ago        19.8MB
108gcr.io/k8s-minikube/storage-provisioner   v5         6e38f40d628d   11 months ago       31.5MB
109functions/markdown-render                 latest     93b5da182216   2 years ago         24.6MB
110functions/hubstats                        latest     01affa91e9e4   2 years ago         29.3MB
111functions/nodeinfo                        latest     2fe8a87bf79c   2 years ago         71.4MB
112functions/alpine                          latest     46c6f6d74471   2 years ago         21.5MB
113prom/prometheus                           v2.11.0    b97ed892eb23   2 years ago         126MB
114prom/alertmanager                         v0.18.0    ce3c87f17369   2 years ago         51.9MB
115alexellis2/openfaas-colorization          0.4.1      d36b67b1b5c1   2 years ago         1.84GB
116rorpage/text-to-speech                    latest     5dc20810eb54   2 years ago         86.9MB
117stefanprodan/faas-grafana                 4.6.3      2a4bd9caea50   4 years ago         284MB
118
119$ kubectl get pods --all-namespaces
120NAMESPACE              NAME                                        READY   STATUS             RESTARTS        AGE
121kube-system            coredns-64897985d-kp7vf                     1/1     Running            0               6d
122kube-system            etcd-minikube                               1/1     Running            0               6d
123kube-system            kube-apiserver-minikube                     1/1     Running            0               6d
124kube-system            kube-controller-manager-minikube            1/1     Running            0               6d
125kube-system            kube-proxy-5m8lr                            1/1     Running            0               6d
126kube-system            kube-scheduler-minikube                     1/1     Running            0               6d
127kube-system            storage-provisioner                         1/1     Running            1 (6d ago)      6d
128kubernetes-dashboard   dashboard-metrics-scraper-58549894f-97tsv   1/1     Running            0               5d7h
129kubernetes-dashboard   kubernetes-dashboard-ccd587f44-lkwcx        1/1     Running            0               5d7h
130openfaas-fn            base64-6bdbcdb64c-djz8f                     1/1     Running            0               5d1h
131openfaas-fn            colorise-85c74c686b-2fz66                   1/1     Running            0               4d5h
132openfaas-fn            echoit-5d7df6684c-k6ljn                     1/1     Running            0               5d1h
133openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0               4d5h
134openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0               4d19h
135openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0               4d3h
136openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0               4d3h
137openfaas-fn            hello-openfaas2-5c6f6cb5d9-24hkz            0/1     ImagePullBackOff   0               9m22s
138openfaas-fn            hello-openfaas2-8957bb47b-7cgjg             0/1     ImagePullBackOff   0               2d22h
139openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0               4d2h
140openfaas-fn            hello-python-6d6976845f-cwsln               0/1     ImagePullBackOff   0               3d19h
141openfaas-fn            hello-python-b577cb8dc-64wf5                0/1     ImagePullBackOff   0               3d9h
142openfaas-fn            hubstats-b6cd4dccc-z8tvl                    1/1     Running            0               5d1h
143openfaas-fn            markdown-68f69f47c8-w5m47                   1/1     Running            0               5d1h
144openfaas-fn            nodeinfo-d48cbbfcc-hfj79                    1/1     Running            0               5d1h
145openfaas-fn            openfaas2-fun                               1/1     Running            0               15s
146openfaas-fn            text-to-speech-74ffcdfd7-997t4              0/1     CrashLoopBackOff   2235 (3s ago)   4d5h
147openfaas-fn            wordcount-6489865566-cvfzr                  1/1     Running            0               5d1h
148openfaas               alertmanager-88449c789-fq2rg                1/1     Running            0               3d1h
149openfaas               basic-auth-plugin-75fd7d69c5-zw4jh          1/1     Running            0               3d2h
150openfaas               gateway-5c4bb7c5d7-n8h27                    2/2     Running            0               3d2h
151openfaas               grafana                                     1/1     Running            0               4d8h
152openfaas               nats-647b476664-hkr7p                       1/1     Running            0               3d2h
153openfaas               prometheus-687648749f-tl8jp                 1/1     Running            0               3d1h
154openfaas               queue-worker-7777ffd7f6-htx6t               1/1     Running            0               3d2h
155
156
157$ kubectl get -o yaml -n openfaas-fn deploy/hello-openfaas2
158apiVersion: apps/v1
159kind: Deployment
160metadata:
161  annotations:
162    deployment.kubernetes.io/revision: "6"
163    prometheus.io.scrape: "false"
164  creationTimestamp: "2022-03-17T12:47:35Z"
165  generation: 6
166  labels:
167    faas_function: hello-openfaas2
168  name: hello-openfaas2
169  namespace: openfaas-fn
170  resourceVersion: "400833"
171  uid: 9c4e9d26-23af-4f93-8538-4e2d96f0d7e0
172spec:
173  progressDeadlineSeconds: 600
174  replicas: 1
175  revisionHistoryLimit: 10
176  selector:
177    matchLabels:
178      faas_function: hello-openfaas2
179  strategy:
180    rollingUpdate:
181      maxSurge: 1
182      maxUnavailable: 0
183    type: RollingUpdate
184  template:
185    metadata:
186      annotations:
187        prometheus.io.scrape: "false"
188      creationTimestamp: null
189      labels:
190        faas_function: hello-openfaas2
191        uid: "969512830"
192      name: hello-openfaas2
193    spec:
194      containers:
195      - env:
196        - name: fprocess
197          value: python3 index.py
198        image: wm/hello-openfaas2:0.1
199        imagePullPolicy: Always
200        livenessProbe:
201          failureThreshold: 3
202          httpGet:
203            path: /_/health
204            port: 8080
205            scheme: HTTP
206          initialDelaySeconds: 2
207          periodSeconds: 2
208          successThreshold: 1
209          timeoutSeconds: 1
210        name: hello-openfaas2
211        ports:
212        - containerPort: 8080
213          name: http
214          protocol: TCP
215        readinessProbe:
216          failureThreshold: 3
217          httpGet:
218            path: /_/health
219            port: 8080
220            scheme: HTTP
221          initialDelaySeconds: 2
222          periodSeconds: 2
223          successThreshold: 1
224          timeoutSeconds: 1
225        resources: {}
226        securityContext:
227          allowPrivilegeEscalation: false
228          readOnlyRootFilesystem: false
229        terminationMessagePath: /dev/termination-log
230        terminationMessagePolicy: File
231      dnsPolicy: ClusterFirst
232      enableServiceLinks: false
233      restartPolicy: Always
234      schedulerName: default-scheduler
235      securityContext: {}
236      terminationGracePeriodSeconds: 30
237status:
238  conditions:
239  - lastTransitionTime: "2022-03-17T12:47:35Z"
240    lastUpdateTime: "2022-03-17T12:47:35Z"
241    message: Deployment does not have minimum availability.
242    reason: MinimumReplicasUnavailable
243    status: "False"
244    type: Available
245  - lastTransitionTime: "2022-03-20T12:16:56Z"
246    lastUpdateTime: "2022-03-20T12:16:56Z"
247    message: ReplicaSet "hello-openfaas2-5d6c7c7fb4" has timed out progressing.
248    reason: ProgressDeadlineExceeded
249    status: "False"
250    type: Progressing
251  observedGeneration: 6
252  replicas: 2
253  unavailableReplicas: 2
254  updatedReplicas: 1
255

In one shell,

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60$ faas-cli new --lang python3 hello-openfaas2 --prefix="wm"
61Folder: hello-openfaas2 created.
62# I add `imagePullPolicy: Never` to `hello-openfaas2.yml`
63$ faas-cli build -f ./hello-openfaas2.yml 
64$ faas-cli deploy -f ./hello-openfaas2.yml 
65Deploying: hello-openfaas2.
66WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
67
68Deployed. 202 Accepted.
69URL: http://192.168.1.3:8099/function/hello-openfaas2
70
71
72$ kubectl logs -n openfaas-fn deploy/hello-openfaas2
73Error from server (BadRequest): container "hello-openfaas2" in pod "hello-openfaas2-7c67488865-7d7vm" is waiting to start: image can't be pulled
74
75$ kubectl get pods --all-namespaces
76NAMESPACE              NAME                                        READY   STATUS             RESTARTS         AGE
77kube-system            coredns-64897985d-kp7vf                     1/1     Running            0                47h
78...
79openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0                4h28m
80openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0                18h
81openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0                127m
82openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0                165m
83openfaas-fn            hello-openfaas2-7c67488865-qmrkl            0/1     ImagePullBackOff   0                13m
84openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0                97m
85openfaas-fn            hello-python-554b464498-zxcdv               0/1     ErrImagePull       0                3h23m
86openfaas-fn            hello-python-8698bc68bd-62gh9               0/1     ImagePullBackOff   0                3h25m
87$ docker images
88REPOSITORY                                TAG        IMAGE ID       CREATED             SIZE
89wm/hello-openfaas2                        0.1        03c21bd96d5e   About an hour ago   65.2MB
90python                                    3-alpine   69fba17b9bae   12 days ago         48.6MB
91ghcr.io/openfaas/figlet                   latest     ca5eef0de441   2 weeks ago         14.8MB
92ghcr.io/openfaas/alpine                   latest     35f3d4be6bb8   2 weeks ago         14.2MB
93ghcr.io/openfaas/faas-netes               0.14.2     524b510505ec   3 weeks ago         77.3MB
94k8s.gcr.io/kube-apiserver                 v1.23.3    f40be0088a83   7 weeks ago         135MB
95k8s.gcr.io/kube-controller-manager        v1.23.3    b07520cd7ab7   7 weeks ago         125MB
96k8s.gcr.io/kube-scheduler                 v1.23.3    99a3486be4f2   7 weeks ago         53.5MB
97k8s.gcr.io/kube-proxy                     v1.23.3    9b7cc9982109   7 weeks ago         112MB
98ghcr.io/openfaas/gateway                  0.21.3     ab4851262cd1   7 weeks ago         30.6MB
99ghcr.io/openfaas/basic-auth               0.21.3     16e7168a17a3   7 weeks ago         14.3MB
100k8s.gcr.io/etcd                           3.5.1-0    25f8c7f3da61   4 months ago        293MB
101ghcr.io/openfaas/classic-watchdog         0.2.0      6f97aa96da81   4 months ago        8.18MB
102k8s.gcr.io/coredns/coredns                v1.8.6     a4ca41631cc7   5 months ago        46.8MB
103k8s.gcr.io/pause                          3.6        6270bb605e12   6 months ago        683kB
104ghcr.io/openfaas/queue-worker             0.12.2     56e7216201bc   7 months ago        7.97MB
105kubernetesui/dashboard                    v2.3.1     e1482a24335a   9 months ago        220MB
106kubernetesui/metrics-scraper              v1.0.7     7801cfc6d5c0   9 months ago        34.4MB
107nats-streaming                            0.22.0     12f2d32e0c9a   9 months ago        19.8MB
108gcr.io/k8s-minikube/storage-provisioner   v5         6e38f40d628d   11 months ago       31.5MB
109functions/markdown-render                 latest     93b5da182216   2 years ago         24.6MB
110functions/hubstats                        latest     01affa91e9e4   2 years ago         29.3MB
111functions/nodeinfo                        latest     2fe8a87bf79c   2 years ago         71.4MB
112functions/alpine                          latest     46c6f6d74471   2 years ago         21.5MB
113prom/prometheus                           v2.11.0    b97ed892eb23   2 years ago         126MB
114prom/alertmanager                         v0.18.0    ce3c87f17369   2 years ago         51.9MB
115alexellis2/openfaas-colorization          0.4.1      d36b67b1b5c1   2 years ago         1.84GB
116rorpage/text-to-speech                    latest     5dc20810eb54   2 years ago         86.9MB
117stefanprodan/faas-grafana                 4.6.3      2a4bd9caea50   4 years ago         284MB
118
119$ kubectl get pods --all-namespaces
120NAMESPACE              NAME                                        READY   STATUS             RESTARTS        AGE
121kube-system            coredns-64897985d-kp7vf                     1/1     Running            0               6d
122kube-system            etcd-minikube                               1/1     Running            0               6d
123kube-system            kube-apiserver-minikube                     1/1     Running            0               6d
124kube-system            kube-controller-manager-minikube            1/1     Running            0               6d
125kube-system            kube-proxy-5m8lr                            1/1     Running            0               6d
126kube-system            kube-scheduler-minikube                     1/1     Running            0               6d
127kube-system            storage-provisioner                         1/1     Running            1 (6d ago)      6d
128kubernetes-dashboard   dashboard-metrics-scraper-58549894f-97tsv   1/1     Running            0               5d7h
129kubernetes-dashboard   kubernetes-dashboard-ccd587f44-lkwcx        1/1     Running            0               5d7h
130openfaas-fn            base64-6bdbcdb64c-djz8f                     1/1     Running            0               5d1h
131openfaas-fn            colorise-85c74c686b-2fz66                   1/1     Running            0               4d5h
132openfaas-fn            echoit-5d7df6684c-k6ljn                     1/1     Running            0               5d1h
133openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0               4d5h
134openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0               4d19h
135openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0               4d3h
136openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0               4d3h
137openfaas-fn            hello-openfaas2-5c6f6cb5d9-24hkz            0/1     ImagePullBackOff   0               9m22s
138openfaas-fn            hello-openfaas2-8957bb47b-7cgjg             0/1     ImagePullBackOff   0               2d22h
139openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0               4d2h
140openfaas-fn            hello-python-6d6976845f-cwsln               0/1     ImagePullBackOff   0               3d19h
141openfaas-fn            hello-python-b577cb8dc-64wf5                0/1     ImagePullBackOff   0               3d9h
142openfaas-fn            hubstats-b6cd4dccc-z8tvl                    1/1     Running            0               5d1h
143openfaas-fn            markdown-68f69f47c8-w5m47                   1/1     Running            0               5d1h
144openfaas-fn            nodeinfo-d48cbbfcc-hfj79                    1/1     Running            0               5d1h
145openfaas-fn            openfaas2-fun                               1/1     Running            0               15s
146openfaas-fn            text-to-speech-74ffcdfd7-997t4              0/1     CrashLoopBackOff   2235 (3s ago)   4d5h
147openfaas-fn            wordcount-6489865566-cvfzr                  1/1     Running            0               5d1h
148openfaas               alertmanager-88449c789-fq2rg                1/1     Running            0               3d1h
149openfaas               basic-auth-plugin-75fd7d69c5-zw4jh          1/1     Running            0               3d2h
150openfaas               gateway-5c4bb7c5d7-n8h27                    2/2     Running            0               3d2h
151openfaas               grafana                                     1/1     Running            0               4d8h
152openfaas               nats-647b476664-hkr7p                       1/1     Running            0               3d2h
153openfaas               prometheus-687648749f-tl8jp                 1/1     Running            0               3d1h
154openfaas               queue-worker-7777ffd7f6-htx6t               1/1     Running            0               3d2h
155
156
157$ kubectl get -o yaml -n openfaas-fn deploy/hello-openfaas2
158apiVersion: apps/v1
159kind: Deployment
160metadata:
161  annotations:
162    deployment.kubernetes.io/revision: "6"
163    prometheus.io.scrape: "false"
164  creationTimestamp: "2022-03-17T12:47:35Z"
165  generation: 6
166  labels:
167    faas_function: hello-openfaas2
168  name: hello-openfaas2
169  namespace: openfaas-fn
170  resourceVersion: "400833"
171  uid: 9c4e9d26-23af-4f93-8538-4e2d96f0d7e0
172spec:
173  progressDeadlineSeconds: 600
174  replicas: 1
175  revisionHistoryLimit: 10
176  selector:
177    matchLabels:
178      faas_function: hello-openfaas2
179  strategy:
180    rollingUpdate:
181      maxSurge: 1
182      maxUnavailable: 0
183    type: RollingUpdate
184  template:
185    metadata:
186      annotations:
187        prometheus.io.scrape: "false"
188      creationTimestamp: null
189      labels:
190        faas_function: hello-openfaas2
191        uid: "969512830"
192      name: hello-openfaas2
193    spec:
194      containers:
195      - env:
196        - name: fprocess
197          value: python3 index.py
198        image: wm/hello-openfaas2:0.1
199        imagePullPolicy: Always
200        livenessProbe:
201          failureThreshold: 3
202          httpGet:
203            path: /_/health
204            port: 8080
205            scheme: HTTP
206          initialDelaySeconds: 2
207          periodSeconds: 2
208          successThreshold: 1
209          timeoutSeconds: 1
210        name: hello-openfaas2
211        ports:
212        - containerPort: 8080
213          name: http
214          protocol: TCP
215        readinessProbe:
216          failureThreshold: 3
217          httpGet:
218            path: /_/health
219            port: 8080
220            scheme: HTTP
221          initialDelaySeconds: 2
222          periodSeconds: 2
223          successThreshold: 1
224          timeoutSeconds: 1
225        resources: {}
226        securityContext:
227          allowPrivilegeEscalation: false
228          readOnlyRootFilesystem: false
229        terminationMessagePath: /dev/termination-log
230        terminationMessagePolicy: File
231      dnsPolicy: ClusterFirst
232      enableServiceLinks: false
233      restartPolicy: Always
234      schedulerName: default-scheduler
235      securityContext: {}
236      terminationGracePeriodSeconds: 30
237status:
238  conditions:
239  - lastTransitionTime: "2022-03-17T12:47:35Z"
240    lastUpdateTime: "2022-03-17T12:47:35Z"
241    message: Deployment does not have minimum availability.
242    reason: MinimumReplicasUnavailable
243    status: "False"
244    type: Available
245  - lastTransitionTime: "2022-03-20T12:16:56Z"
246    lastUpdateTime: "2022-03-20T12:16:56Z"
247    message: ReplicaSet "hello-openfaas2-5d6c7c7fb4" has timed out progressing.
248    reason: ProgressDeadlineExceeded
249    status: "False"
250    type: Progressing
251  observedGeneration: 6
252  replicas: 2
253  unavailableReplicas: 2
254  updatedReplicas: 1
255docker@minikube:~$ docker run  --name wm -ti wm/hello-openfaas2:0.1
2562022/03/20 13:04:52 Version: 0.2.0  SHA: 56bf6aac54deb3863a690f5fc03a2a38e7d9e6ef
2572022/03/20 13:04:52 Timeouts: read: 5s write: 5s hard: 0s health: 5s.
2582022/03/20 13:04:52 Listening on port: 8080
259...
260
261

and another shell

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60$ faas-cli new --lang python3 hello-openfaas2 --prefix="wm"
61Folder: hello-openfaas2 created.
62# I add `imagePullPolicy: Never` to `hello-openfaas2.yml`
63$ faas-cli build -f ./hello-openfaas2.yml 
64$ faas-cli deploy -f ./hello-openfaas2.yml 
65Deploying: hello-openfaas2.
66WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
67
68Deployed. 202 Accepted.
69URL: http://192.168.1.3:8099/function/hello-openfaas2
70
71
72$ kubectl logs -n openfaas-fn deploy/hello-openfaas2
73Error from server (BadRequest): container "hello-openfaas2" in pod "hello-openfaas2-7c67488865-7d7vm" is waiting to start: image can't be pulled
74
75$ kubectl get pods --all-namespaces
76NAMESPACE              NAME                                        READY   STATUS             RESTARTS         AGE
77kube-system            coredns-64897985d-kp7vf                     1/1     Running            0                47h
78...
79openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0                4h28m
80openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0                18h
81openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0                127m
82openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0                165m
83openfaas-fn            hello-openfaas2-7c67488865-qmrkl            0/1     ImagePullBackOff   0                13m
84openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0                97m
85openfaas-fn            hello-python-554b464498-zxcdv               0/1     ErrImagePull       0                3h23m
86openfaas-fn            hello-python-8698bc68bd-62gh9               0/1     ImagePullBackOff   0                3h25m
87$ docker images
88REPOSITORY                                TAG        IMAGE ID       CREATED             SIZE
89wm/hello-openfaas2                        0.1        03c21bd96d5e   About an hour ago   65.2MB
90python                                    3-alpine   69fba17b9bae   12 days ago         48.6MB
91ghcr.io/openfaas/figlet                   latest     ca5eef0de441   2 weeks ago         14.8MB
92ghcr.io/openfaas/alpine                   latest     35f3d4be6bb8   2 weeks ago         14.2MB
93ghcr.io/openfaas/faas-netes               0.14.2     524b510505ec   3 weeks ago         77.3MB
94k8s.gcr.io/kube-apiserver                 v1.23.3    f40be0088a83   7 weeks ago         135MB
95k8s.gcr.io/kube-controller-manager        v1.23.3    b07520cd7ab7   7 weeks ago         125MB
96k8s.gcr.io/kube-scheduler                 v1.23.3    99a3486be4f2   7 weeks ago         53.5MB
97k8s.gcr.io/kube-proxy                     v1.23.3    9b7cc9982109   7 weeks ago         112MB
98ghcr.io/openfaas/gateway                  0.21.3     ab4851262cd1   7 weeks ago         30.6MB
99ghcr.io/openfaas/basic-auth               0.21.3     16e7168a17a3   7 weeks ago         14.3MB
100k8s.gcr.io/etcd                           3.5.1-0    25f8c7f3da61   4 months ago        293MB
101ghcr.io/openfaas/classic-watchdog         0.2.0      6f97aa96da81   4 months ago        8.18MB
102k8s.gcr.io/coredns/coredns                v1.8.6     a4ca41631cc7   5 months ago        46.8MB
103k8s.gcr.io/pause                          3.6        6270bb605e12   6 months ago        683kB
104ghcr.io/openfaas/queue-worker             0.12.2     56e7216201bc   7 months ago        7.97MB
105kubernetesui/dashboard                    v2.3.1     e1482a24335a   9 months ago        220MB
106kubernetesui/metrics-scraper              v1.0.7     7801cfc6d5c0   9 months ago        34.4MB
107nats-streaming                            0.22.0     12f2d32e0c9a   9 months ago        19.8MB
108gcr.io/k8s-minikube/storage-provisioner   v5         6e38f40d628d   11 months ago       31.5MB
109functions/markdown-render                 latest     93b5da182216   2 years ago         24.6MB
110functions/hubstats                        latest     01affa91e9e4   2 years ago         29.3MB
111functions/nodeinfo                        latest     2fe8a87bf79c   2 years ago         71.4MB
112functions/alpine                          latest     46c6f6d74471   2 years ago         21.5MB
113prom/prometheus                           v2.11.0    b97ed892eb23   2 years ago         126MB
114prom/alertmanager                         v0.18.0    ce3c87f17369   2 years ago         51.9MB
115alexellis2/openfaas-colorization          0.4.1      d36b67b1b5c1   2 years ago         1.84GB
116rorpage/text-to-speech                    latest     5dc20810eb54   2 years ago         86.9MB
117stefanprodan/faas-grafana                 4.6.3      2a4bd9caea50   4 years ago         284MB
118
119$ kubectl get pods --all-namespaces
120NAMESPACE              NAME                                        READY   STATUS             RESTARTS        AGE
121kube-system            coredns-64897985d-kp7vf                     1/1     Running            0               6d
122kube-system            etcd-minikube                               1/1     Running            0               6d
123kube-system            kube-apiserver-minikube                     1/1     Running            0               6d
124kube-system            kube-controller-manager-minikube            1/1     Running            0               6d
125kube-system            kube-proxy-5m8lr                            1/1     Running            0               6d
126kube-system            kube-scheduler-minikube                     1/1     Running            0               6d
127kube-system            storage-provisioner                         1/1     Running            1 (6d ago)      6d
128kubernetes-dashboard   dashboard-metrics-scraper-58549894f-97tsv   1/1     Running            0               5d7h
129kubernetes-dashboard   kubernetes-dashboard-ccd587f44-lkwcx        1/1     Running            0               5d7h
130openfaas-fn            base64-6bdbcdb64c-djz8f                     1/1     Running            0               5d1h
131openfaas-fn            colorise-85c74c686b-2fz66                   1/1     Running            0               4d5h
132openfaas-fn            echoit-5d7df6684c-k6ljn                     1/1     Running            0               5d1h
133openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0               4d5h
134openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0               4d19h
135openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0               4d3h
136openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0               4d3h
137openfaas-fn            hello-openfaas2-5c6f6cb5d9-24hkz            0/1     ImagePullBackOff   0               9m22s
138openfaas-fn            hello-openfaas2-8957bb47b-7cgjg             0/1     ImagePullBackOff   0               2d22h
139openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0               4d2h
140openfaas-fn            hello-python-6d6976845f-cwsln               0/1     ImagePullBackOff   0               3d19h
141openfaas-fn            hello-python-b577cb8dc-64wf5                0/1     ImagePullBackOff   0               3d9h
142openfaas-fn            hubstats-b6cd4dccc-z8tvl                    1/1     Running            0               5d1h
143openfaas-fn            markdown-68f69f47c8-w5m47                   1/1     Running            0               5d1h
144openfaas-fn            nodeinfo-d48cbbfcc-hfj79                    1/1     Running            0               5d1h
145openfaas-fn            openfaas2-fun                               1/1     Running            0               15s
146openfaas-fn            text-to-speech-74ffcdfd7-997t4              0/1     CrashLoopBackOff   2235 (3s ago)   4d5h
147openfaas-fn            wordcount-6489865566-cvfzr                  1/1     Running            0               5d1h
148openfaas               alertmanager-88449c789-fq2rg                1/1     Running            0               3d1h
149openfaas               basic-auth-plugin-75fd7d69c5-zw4jh          1/1     Running            0               3d2h
150openfaas               gateway-5c4bb7c5d7-n8h27                    2/2     Running            0               3d2h
151openfaas               grafana                                     1/1     Running            0               4d8h
152openfaas               nats-647b476664-hkr7p                       1/1     Running            0               3d2h
153openfaas               prometheus-687648749f-tl8jp                 1/1     Running            0               3d1h
154openfaas               queue-worker-7777ffd7f6-htx6t               1/1     Running            0               3d2h
155
156
157$ kubectl get -o yaml -n openfaas-fn deploy/hello-openfaas2
158apiVersion: apps/v1
159kind: Deployment
160metadata:
161  annotations:
162    deployment.kubernetes.io/revision: "6"
163    prometheus.io.scrape: "false"
164  creationTimestamp: "2022-03-17T12:47:35Z"
165  generation: 6
166  labels:
167    faas_function: hello-openfaas2
168  name: hello-openfaas2
169  namespace: openfaas-fn
170  resourceVersion: "400833"
171  uid: 9c4e9d26-23af-4f93-8538-4e2d96f0d7e0
172spec:
173  progressDeadlineSeconds: 600
174  replicas: 1
175  revisionHistoryLimit: 10
176  selector:
177    matchLabels:
178      faas_function: hello-openfaas2
179  strategy:
180    rollingUpdate:
181      maxSurge: 1
182      maxUnavailable: 0
183    type: RollingUpdate
184  template:
185    metadata:
186      annotations:
187        prometheus.io.scrape: "false"
188      creationTimestamp: null
189      labels:
190        faas_function: hello-openfaas2
191        uid: "969512830"
192      name: hello-openfaas2
193    spec:
194      containers:
195      - env:
196        - name: fprocess
197          value: python3 index.py
198        image: wm/hello-openfaas2:0.1
199        imagePullPolicy: Always
200        livenessProbe:
201          failureThreshold: 3
202          httpGet:
203            path: /_/health
204            port: 8080
205            scheme: HTTP
206          initialDelaySeconds: 2
207          periodSeconds: 2
208          successThreshold: 1
209          timeoutSeconds: 1
210        name: hello-openfaas2
211        ports:
212        - containerPort: 8080
213          name: http
214          protocol: TCP
215        readinessProbe:
216          failureThreshold: 3
217          httpGet:
218            path: /_/health
219            port: 8080
220            scheme: HTTP
221          initialDelaySeconds: 2
222          periodSeconds: 2
223          successThreshold: 1
224          timeoutSeconds: 1
225        resources: {}
226        securityContext:
227          allowPrivilegeEscalation: false
228          readOnlyRootFilesystem: false
229        terminationMessagePath: /dev/termination-log
230        terminationMessagePolicy: File
231      dnsPolicy: ClusterFirst
232      enableServiceLinks: false
233      restartPolicy: Always
234      schedulerName: default-scheduler
235      securityContext: {}
236      terminationGracePeriodSeconds: 30
237status:
238  conditions:
239  - lastTransitionTime: "2022-03-17T12:47:35Z"
240    lastUpdateTime: "2022-03-17T12:47:35Z"
241    message: Deployment does not have minimum availability.
242    reason: MinimumReplicasUnavailable
243    status: "False"
244    type: Available
245  - lastTransitionTime: "2022-03-20T12:16:56Z"
246    lastUpdateTime: "2022-03-20T12:16:56Z"
247    message: ReplicaSet "hello-openfaas2-5d6c7c7fb4" has timed out progressing.
248    reason: ProgressDeadlineExceeded
249    status: "False"
250    type: Progressing
251  observedGeneration: 6
252  replicas: 2
253  unavailableReplicas: 2
254  updatedReplicas: 1
255docker@minikube:~$ docker run  --name wm -ti wm/hello-openfaas2:0.1
2562022/03/20 13:04:52 Version: 0.2.0  SHA: 56bf6aac54deb3863a690f5fc03a2a38e7d9e6ef
2572022/03/20 13:04:52 Timeouts: read: 5s write: 5s hard: 0s health: 5s.
2582022/03/20 13:04:52 Listening on port: 8080
259...
260
261docker@minikube:~$ docker ps | grep wm
262d7796286641c   wm/hello-openfaas2:0.1             "fwatchdog"              3 minutes ago       Up 3 minutes (healthy)   8080/tcp   wm
263

ANSWER

Answered 2022-Mar-16 at 08:10

If your image has a latest tag, the Pod's ImagePullPolicy will be automatically set to Always. Each time the pod is created, Kubernetes tries to pull the newest image.

Try not tagging the image as latest or manually setting the Pod's ImagePullPolicy to Never. If you're using static manifest to create a Pod, the setting will be like the following:

copy icondownload icon

1$ docker images | grep hello-openfaas
2wm/hello-openfaas                                     latest                          bd08d01ce09b   34 minutes ago      65.2MB
3$ faas-cli deploy -f ./hello-openfaas.yml 
4Deploying: hello-openfaas.
5WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
6
7Deployed. 202 Accepted.
8URL: http://IP:8099/function/hello-openfaas
9see the helm chart for how to set the ImagePullPolicy
10$ kubectl logs -n openfaas-fn deploy/hello-openfaas
11Error from server (BadRequest): container "hello-openfaas" in pod "hello-openfaas-558f99477f-wd697" is waiting to start: trying and failing to pull image
12
13$ kubectl describe -n openfaas-fn deploy/hello-openfaas
14Name:                   hello-openfaas
15Namespace:              openfaas-fn
16CreationTimestamp:      Wed, 16 Mar 2022 14:59:49 +0800
17Labels:                 faas_function=hello-openfaas
18Annotations:            deployment.kubernetes.io/revision: 1
19                        prometheus.io.scrape: false
20Selector:               faas_function=hello-openfaas
21Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
22StrategyType:           RollingUpdate
23MinReadySeconds:        0
24RollingUpdateStrategy:  0 max unavailable, 1 max surge
25Pod Template:
26  Labels:       faas_function=hello-openfaas
27  Annotations:  prometheus.io.scrape: false
28  Containers:
29   hello-openfaas:
30    Image:      wm/hello-openfaas:latest
31    Port:       8080/TCP
32    Host Port:  0/TCP
33    Liveness:   http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
34    Readiness:  http-get http://:8080/_/health delay=2s timeout=1s period=2s #success=1 #failure=3
35    Environment:
36      fprocess:  python3 index.py
37    Mounts:      <none>
38  Volumes:       <none>
39Conditions:
40  Type           Status  Reason
41  ----           ------  ------
42  Available      False   MinimumReplicasUnavailable
43  Progressing    False   ProgressDeadlineExceeded
44OldReplicaSets:  <none>
45NewReplicaSet:   hello-openfaas-558f99477f (1/1 replicas created)
46Events:
47  Type    Reason             Age   From                   Message
48  ----    ------             ----  ----                   -------
49  Normal  ScalingReplicaSet  29m   deployment-controller  Scaled up replica set hello-openfaas-558f99477f to 1
50version: 1.0
51provider:
52  name: openfaas
53  gateway: http://IP:8099
54functions:
55  hello-openfaas:
56    lang: python3
57    handler: ./hello-openfaas
58    image: wm/hello-openfaas:latest
59    imagePullPolicy: Never
60$ faas-cli new --lang python3 hello-openfaas2 --prefix="wm"
61Folder: hello-openfaas2 created.
62# I add `imagePullPolicy: Never` to `hello-openfaas2.yml`
63$ faas-cli build -f ./hello-openfaas2.yml 
64$ faas-cli deploy -f ./hello-openfaas2.yml 
65Deploying: hello-openfaas2.
66WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.
67
68Deployed. 202 Accepted.
69URL: http://192.168.1.3:8099/function/hello-openfaas2
70
71
72$ kubectl logs -n openfaas-fn deploy/hello-openfaas2
73Error from server (BadRequest): container "hello-openfaas2" in pod "hello-openfaas2-7c67488865-7d7vm" is waiting to start: image can't be pulled
74
75$ kubectl get pods --all-namespaces
76NAMESPACE              NAME                                        READY   STATUS             RESTARTS         AGE
77kube-system            coredns-64897985d-kp7vf                     1/1     Running            0                47h
78...
79openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0                4h28m
80openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0                18h
81openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0                127m
82openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0                165m
83openfaas-fn            hello-openfaas2-7c67488865-qmrkl            0/1     ImagePullBackOff   0                13m
84openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0                97m
85openfaas-fn            hello-python-554b464498-zxcdv               0/1     ErrImagePull       0                3h23m
86openfaas-fn            hello-python-8698bc68bd-62gh9               0/1     ImagePullBackOff   0                3h25m
87$ docker images
88REPOSITORY                                TAG        IMAGE ID       CREATED             SIZE
89wm/hello-openfaas2                        0.1        03c21bd96d5e   About an hour ago   65.2MB
90python                                    3-alpine   69fba17b9bae   12 days ago         48.6MB
91ghcr.io/openfaas/figlet                   latest     ca5eef0de441   2 weeks ago         14.8MB
92ghcr.io/openfaas/alpine                   latest     35f3d4be6bb8   2 weeks ago         14.2MB
93ghcr.io/openfaas/faas-netes               0.14.2     524b510505ec   3 weeks ago         77.3MB
94k8s.gcr.io/kube-apiserver                 v1.23.3    f40be0088a83   7 weeks ago         135MB
95k8s.gcr.io/kube-controller-manager        v1.23.3    b07520cd7ab7   7 weeks ago         125MB
96k8s.gcr.io/kube-scheduler                 v1.23.3    99a3486be4f2   7 weeks ago         53.5MB
97k8s.gcr.io/kube-proxy                     v1.23.3    9b7cc9982109   7 weeks ago         112MB
98ghcr.io/openfaas/gateway                  0.21.3     ab4851262cd1   7 weeks ago         30.6MB
99ghcr.io/openfaas/basic-auth               0.21.3     16e7168a17a3   7 weeks ago         14.3MB
100k8s.gcr.io/etcd                           3.5.1-0    25f8c7f3da61   4 months ago        293MB
101ghcr.io/openfaas/classic-watchdog         0.2.0      6f97aa96da81   4 months ago        8.18MB
102k8s.gcr.io/coredns/coredns                v1.8.6     a4ca41631cc7   5 months ago        46.8MB
103k8s.gcr.io/pause                          3.6        6270bb605e12   6 months ago        683kB
104ghcr.io/openfaas/queue-worker             0.12.2     56e7216201bc   7 months ago        7.97MB
105kubernetesui/dashboard                    v2.3.1     e1482a24335a   9 months ago        220MB
106kubernetesui/metrics-scraper              v1.0.7     7801cfc6d5c0   9 months ago        34.4MB
107nats-streaming                            0.22.0     12f2d32e0c9a   9 months ago        19.8MB
108gcr.io/k8s-minikube/storage-provisioner   v5         6e38f40d628d   11 months ago       31.5MB
109functions/markdown-render                 latest     93b5da182216   2 years ago         24.6MB
110functions/hubstats                        latest     01affa91e9e4   2 years ago         29.3MB
111functions/nodeinfo                        latest     2fe8a87bf79c   2 years ago         71.4MB
112functions/alpine                          latest     46c6f6d74471   2 years ago         21.5MB
113prom/prometheus                           v2.11.0    b97ed892eb23   2 years ago         126MB
114prom/alertmanager                         v0.18.0    ce3c87f17369   2 years ago         51.9MB
115alexellis2/openfaas-colorization          0.4.1      d36b67b1b5c1   2 years ago         1.84GB
116rorpage/text-to-speech                    latest     5dc20810eb54   2 years ago         86.9MB
117stefanprodan/faas-grafana                 4.6.3      2a4bd9caea50   4 years ago         284MB
118
119$ kubectl get pods --all-namespaces
120NAMESPACE              NAME                                        READY   STATUS             RESTARTS        AGE
121kube-system            coredns-64897985d-kp7vf                     1/1     Running            0               6d
122kube-system            etcd-minikube                               1/1     Running            0               6d
123kube-system            kube-apiserver-minikube                     1/1     Running            0               6d
124kube-system            kube-controller-manager-minikube            1/1     Running            0               6d
125kube-system            kube-proxy-5m8lr                            1/1     Running            0               6d
126kube-system            kube-scheduler-minikube                     1/1     Running            0               6d
127kube-system            storage-provisioner                         1/1     Running            1 (6d ago)      6d
128kubernetes-dashboard   dashboard-metrics-scraper-58549894f-97tsv   1/1     Running            0               5d7h
129kubernetes-dashboard   kubernetes-dashboard-ccd587f44-lkwcx        1/1     Running            0               5d7h
130openfaas-fn            base64-6bdbcdb64c-djz8f                     1/1     Running            0               5d1h
131openfaas-fn            colorise-85c74c686b-2fz66                   1/1     Running            0               4d5h
132openfaas-fn            echoit-5d7df6684c-k6ljn                     1/1     Running            0               5d1h
133openfaas-fn            env-6c79f7b946-bzbtm                        1/1     Running            0               4d5h
134openfaas-fn            figlet-54db496f88-957xl                     1/1     Running            0               4d19h
135openfaas-fn            hello-openfaas-547857b9d6-z277c             0/1     ImagePullBackOff   0               4d3h
136openfaas-fn            hello-openfaas-7b6946b4f9-hcvq4             0/1     ImagePullBackOff   0               4d3h
137openfaas-fn            hello-openfaas2-5c6f6cb5d9-24hkz            0/1     ImagePullBackOff   0               9m22s
138openfaas-fn            hello-openfaas2-8957bb47b-7cgjg             0/1     ImagePullBackOff   0               2d22h
139openfaas-fn            hello-openfaas3-65847b8b67-b94kd            0/1     ImagePullBackOff   0               4d2h
140openfaas-fn            hello-python-6d6976845f-cwsln               0/1     ImagePullBackOff   0               3d19h
141openfaas-fn            hello-python-b577cb8dc-64wf5                0/1     ImagePullBackOff   0               3d9h
142openfaas-fn            hubstats-b6cd4dccc-z8tvl                    1/1     Running            0               5d1h
143openfaas-fn            markdown-68f69f47c8-w5m47                   1/1     Running            0               5d1h
144openfaas-fn            nodeinfo-d48cbbfcc-hfj79                    1/1     Running            0               5d1h
145openfaas-fn            openfaas2-fun                               1/1     Running            0               15s
146openfaas-fn            text-to-speech-74ffcdfd7-997t4              0/1     CrashLoopBackOff   2235 (3s ago)   4d5h
147openfaas-fn            wordcount-6489865566-cvfzr                  1/1     Running            0               5d1h
148openfaas               alertmanager-88449c789-fq2rg                1/1     Running            0               3d1h
149openfaas               basic-auth-plugin-75fd7d69c5-zw4jh          1/1     Running            0               3d2h
150openfaas               gateway-5c4bb7c5d7-n8h27                    2/2     Running            0               3d2h
151openfaas               grafana                                     1/1     Running            0               4d8h
152openfaas               nats-647b476664-hkr7p                       1/1     Running            0               3d2h
153openfaas               prometheus-687648749f-tl8jp                 1/1     Running            0               3d1h
154openfaas               queue-worker-7777ffd7f6-htx6t               1/1     Running            0               3d2h
155
156
157$ kubectl get -o yaml -n openfaas-fn deploy/hello-openfaas2
158apiVersion: apps/v1
159kind: Deployment
160metadata:
161  annotations:
162    deployment.kubernetes.io/revision: "6"
163    prometheus.io.scrape: "false"
164  creationTimestamp: "2022-03-17T12:47:35Z"
165  generation: 6
166  labels:
167    faas_function: hello-openfaas2
168  name: hello-openfaas2
169  namespace: openfaas-fn
170  resourceVersion: "400833"
171  uid: 9c4e9d26-23af-4f93-8538-4e2d96f0d7e0
172spec:
173  progressDeadlineSeconds: 600
174  replicas: 1
175  revisionHistoryLimit: 10
176  selector:
177    matchLabels:
178      faas_function: hello-openfaas2
179  strategy:
180    rollingUpdate:
181      maxSurge: 1
182      maxUnavailable: 0
183    type: RollingUpdate
184  template:
185    metadata:
186      annotations:
187        prometheus.io.scrape: "false"
188      creationTimestamp: null
189      labels:
190        faas_function: hello-openfaas2
191        uid: "969512830"
192      name: hello-openfaas2
193    spec:
194      containers:
195      - env:
196        - name: fprocess
197          value: python3 index.py
198        image: wm/hello-openfaas2:0.1
199        imagePullPolicy: Always
200        livenessProbe:
201          failureThreshold: 3
202          httpGet:
203            path: /_/health
204            port: 8080
205            scheme: HTTP
206          initialDelaySeconds: 2
207          periodSeconds: 2
208          successThreshold: 1
209          timeoutSeconds: 1
210        name: hello-openfaas2
211        ports:
212        - containerPort: 8080
213          name: http
214          protocol: TCP
215        readinessProbe:
216          failureThreshold: 3
217          httpGet:
218            path: /_/health
219            port: 8080
220            scheme: HTTP
221          initialDelaySeconds: 2
222          periodSeconds: 2
223          successThreshold: 1
224          timeoutSeconds: 1
225        resources: {}
226        securityContext:
227          allowPrivilegeEscalation: false
228          readOnlyRootFilesystem: false
229        terminationMessagePath: /dev/termination-log
230        terminationMessagePolicy: File
231      dnsPolicy: ClusterFirst
232      enableServiceLinks: false
233      restartPolicy: Always
234      schedulerName: default-scheduler
235      securityContext: {}
236      terminationGracePeriodSeconds: 30
237status:
238  conditions:
239  - lastTransitionTime: "2022-03-17T12:47:35Z"
240    lastUpdateTime: "2022-03-17T12:47:35Z"
241    message: Deployment does not have minimum availability.
242    reason: MinimumReplicasUnavailable
243    status: "False"
244    type: Available
245  - lastTransitionTime: "2022-03-20T12:16:56Z"
246    lastUpdateTime: "2022-03-20T12:16:56Z"
247    message: ReplicaSet "hello-openfaas2-5d6c7c7fb4" has timed out progressing.
248    reason: ProgressDeadlineExceeded
249    status: "False"
250    type: Progressing
251  observedGeneration: 6
252  replicas: 2
253  unavailableReplicas: 2
254  updatedReplicas: 1
255docker@minikube:~$ docker run  --name wm -ti wm/hello-openfaas2:0.1
2562022/03/20 13:04:52 Version: 0.2.0  SHA: 56bf6aac54deb3863a690f5fc03a2a38e7d9e6ef
2572022/03/20 13:04:52 Timeouts: read: 5s write: 5s hard: 0s health: 5s.
2582022/03/20 13:04:52 Listening on port: 8080
259...
260
261docker@minikube:~$ docker ps | grep wm
262d7796286641c   wm/hello-openfaas2:0.1             "fwatchdog"              3 minutes ago       Up 3 minutes (healthy)   8080/tcp   wm
263containers:
264  - name: test-container
265    image: testImage:latest
266    imagePullPolicy: Never
267

Source https://stackoverflow.com/questions/71493306