openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
798 stars 224 forks source link

not finding images when deploying functions #508

Closed pyramation closed 6 years ago

pyramation commented 6 years ago

Hello! Got excited when i found openfaas, newbie here trying to create some template functions, one node and one dockerfile. I'm trying to work locally without a registry -- is that required?

faas new nodefn --lang node
faas build --yaml nodefn.yml
faas deploy --yaml nodefn.yml --gateway 127.0.0.1:31112

faas new dockerfn --lang dockerfile
faas build --yaml dockerfn.yml
faas deploy --yaml dockerfn.yml --gateway 127.0.0.1:31112

Expected Behaviour

I'm expecting the cloud functions to be available

Current Behaviour

image pull backoff loop

openfaas-fn   pod/dockerfn-98d4cbbd-gzhkg                      0/1       ImagePullBackOff   0          3m
openfaas-fn   pod/nodefn-5fb9c54-rt4fc                         0/1       ImagePullBackOff   0          1m

Even though i've checked the docker images locally

REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
nodefn                                     latest              2cb9a7f489d1        7 minutes ago       72.2MB
dockerfn                                   latest              704a0b166524        9 minutes ago       13.1MB

Possible Solution

Am I missing a step? Perhaps i have to use a docker registry? I'd like to work locally, hopefully there is a solution.

Steps to Reproduce (for bugs)

faas new nodefn --lang node
faas build --yaml nodefn.yml
faas deploy --yaml nodefn.yml --gateway 127.0.0.1:31112

faas new dockerfn --lang dockerfile
faas build --yaml dockerfn.yml
faas deploy --yaml dockerfn.yml --gateway 127.0.0.1:31112

Context

was just trying to get started with the cli

Your Environment

$ faas version
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  b5597294da6dd98457434fafe39054c993a5f7e7
 version: 0.6.17

mac - docker for mac

Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:05:26 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:13:46 2018
  OS/Arch:          linux/amd64
  Experimental:     true
 Kubernetes:
  Version:          v1.10.3
  StackAPI:         v1beta2

faas-netes

mac - docker for mac

alexellis commented 6 years ago

Hi there thanks for using OpenFaaS,

The problem is that you need to push your Docker images to a remote repository and you haven't done that. If you want to avoid pushing the images you can work around this with an image pull policy of "IfNotPresent" as defined in the Helm chart instructions in the faas-netes repo.

I don't know if it helps, but you can also combine your functions into a single stack.yml file and then you don't need a -f parameter either.

Can you point me to the instructions that told you that you don't have to push your images on Kubernetes?

Regards,

Alex

LedgeDash commented 5 years ago

I know this is closed a long time ago, but I'm having the same issue with OpenFaaS on top of microk8s on Ubuntu18.04 (so a single-node cluster). And this blog post by Alex says that

If you are using a single-node Docker cluster on your laptop then you can skip this step.

By "this step" it was referring to pushing a function to a remote docker registry.

But what I found is that faas deploy -f [app.yml] results in ImagePullBackOff even though docker images shows that the app's docker image is locally available.

Is there a way to tell faas-cli to fetch the docker image locally??

alexellis commented 4 years ago

"single node Docker cluster" refers to Swarm, you are both clearly not using Swarm or a Docker cluster, but a Kubernetes cluster hence the error: ImagePullBackOff

You can deploy a local registry if you wish, however you are better off using the Docker Hub for ease of use.

https://blog.alexellis.io/get-a-tls-enabled-docker-registry-in-5-minutes/

alexellis commented 4 years ago

/lock

alexellis commented 4 years ago

@woojeonghoon cc (who deleted his comment)

alexellis commented 4 years ago

/msg: slack