Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skaffold Quickstart not working in Google Cloud Shell #4780

Closed
keddyliu opened this issue Sep 14, 2020 · 12 comments · Fixed by #4781
Closed

Skaffold Quickstart not working in Google Cloud Shell #4780

keddyliu opened this issue Sep 14, 2020 · 12 comments · Fixed by #4781

Comments

@keddyliu
Copy link

Expected behavior

The skaffold dev command should work as documented on https://skaffold.dev/docs/quickstart/ .

Actual behavior

Running skaffold dev ends with the error message:

Build Failed. No push access to specified image repository. Trying running with `--default-repo` flag.

Running skaffold dev --default-repo="" ends with the error message:

Build Failed. No push access to specified image repository. Check your `--default-repo` value or try `docker login`.

Information

  • Skaffold version: v1.14.0
  • Operating system: Google Cloud Shell
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta7
kind: Config
build:
  artifacts:
  - image: skaffold-example
deploy:
  kubectl:
    manifests:
      - k8s-*

Steps to reproduce the behavior

  1. Log into Google Cloud Platform and open the Google Cloud Shell.
  2. Go to https://skaffold.dev/docs/quickstart/ .
  3. Install the software under the "Before you begin" section in the Google Cloud Shell.
  4. Run cd skaffold/examples/getting-started.
  5. Run skaffold dev and notice the error message:
Build Failed. No push access to specified image repository. Trying running with `--default-repo` flag.
  1. Run skaffold dev --default-repo="" and notice the error message:
Build Failed. No push access to specified image repository. Check your `--default-repo` value or try `docker login`.
@briandealwis
Copy link
Member

Thanks @keddyliu for pointing out a rather glaring omission on that page! You need to use --default-repo=registry/repository to identify the registry to host the built images.

For example, some of our tests use --default-repo=gcr.io/k8s-skaffold/xxx to reference our k8s-skaffold bucket on Google Container Registry. The images will then be pushed to gcr.io/k8s-skaffold/xxx/image:tag, and the cluster will be instructed to fetch the images from that location.

When using a local cluster like Minikube, --default-repo is usually unnecessary as Skaffold will cause the image to be built and loaded directly into the cluster, saving an upload/download from the repository.

@keddyliu
Copy link
Author

@briandealwis Thanks.

Now, after I run minikube start and then skaffold dev, during the Extracting step in Step 1/7 of Dockerfile , I get an error message saying:

exiting dev mode because first build failed: couldn't build "skaffold-example": unable to stream build output: unexpected EOF

What's going on?

@keddyliu
Copy link
Author

@briandealwis Actually, I reran skaffold dev, and it seems to work now. I do not know why things seem unstable. Thanks.

@keddyliu
Copy link
Author

@briandealwis Now when I run skaffold dev , even when things deploy without errors, I still do not see the Hello world! or Hello Skaffold! print-outs that https://skaffold.dev/docs/quickstart/ mentions. What's going on?

nkubala added a commit that referenced this issue Sep 17, 2020
* Fix #4780: update quickstart to add reference to `--default-repo`

* Update docs/content/en/docs/quickstart/_index.md

Co-authored-by: Nick Kubala <[email protected]>

Co-authored-by: Nick Kubala <[email protected]>
@briandealwis
Copy link
Member

@keddyliu It's hard to diagnose without either a screenshot or full output of what you're seeing. The examples/getting-started app does little more than repeatedly print Hello world!:

func main() {
for {
fmt.Println("Hello world!")
time.Sleep(time.Second * 1)
}
}

Could you try re-running Skaffold with skaffold dev -v debug and attach the output here?

@keddyliu
Copy link
Author

skaffold_output.txt
@briandealwis I attached the text file with the output from the skaffold dev -v debug command. This command would print out this output and just hang there, without printing any more logs or anything.

@briandealwis
Copy link
Member

That's really odd @keddyliu because normally you'd see Skaffold run kubectl logs to stream the logs from the containers.

Press Ctrl+C to exit
DEBU[0013] Change detected <nil>                        
DEBU[0013] Found dependencies for dockerfile: [{main.go /go true}] 
Watching for changes...
DEBU[0014] Found dependencies for dockerfile: [{main.go /go true}] 
INFO[0015] Streaming logs from pod: getting-started container: getting-started 
DEBU[0015] Running command: [kubectl --context minikube logs --since=3s -f getting-started -c getting-started --namespace default] 
[getting-started] Hello world!
[getting-started] Hello world!
[getting-started] Hello world!

@briandealwis
Copy link
Member

@keddyliu I just tried this from the Cloud Shell Terminal and it worked fine. I noticed that Cloud Shell already has Skaffold, Minikube, and Kubectl installed: did you use those versions, or did you download and install your own versions?

I did notice the following warning from minikube start however:

* Creating docker container (CPUs=2, Memory=4000MB) ...
X Docker is nearly out of disk space, which may cause deployments to fail! (85% of capacity)
* Suggestion:
    Try at least one of the following to free up space on the device:

I cloned the Skaffold repository with git clone --depth 1, and I wonder if the full repository history might be enough to tip the image over the limits such that you ran out of disk space and so log messages were not being written out.

@keddyliu
Copy link
Author

@briandealwis I downloaded and am using the latest versions of those three software executables.

@keddyliu
Copy link
Author

@briandealwis I deleted those latest versions of those three software executables from my ~/bin directory which I downloaded from their respective websites, found the versions of the kubectl, minikube, and skaffold executables that are pre-installed on Google Cloud Platform with the which command, copied them over to my ~/bin directory, and got the Quickstart working! Thanks for all your help!

@briandealwis
Copy link
Member

Glad to hear it!

@talgat-ruby
Copy link

I also had issue. Don't forget to check the context. If you are using docker desktop:
Screen Shot 2022-02-08 at 15 43 34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants