knative / build

A Kubernetes-native Build resource.
Apache License 2.0
575 stars 159 forks source link

source-to-url demo failed at building step #306

Open cizixs opened 6 years ago

cizixs commented 6 years ago

/kind bug /kind doc

Expected Behavior

Image build successfuly and containers should be running.

Actual Behavior

Pod stuck at Init:Error status, and the failed init container logs:

➜  knative kubectl logs app-from-source-00001-6nnw6 -c build-step-git-source
2018/08/22 05:26:01 Set StringFlag zap-logger-config to default: .
2018/08/22 05:26:01 Set StringFlag loglevel.git-init to default: .
{"level":"error","ts":1534915561.0482965,"caller":"logging/config.go:42","msg":"Failed to parse the logging config. Falling back to default logger.","error":"empty logging configuration","build.knative.dev/jsonconfig":"","stacktrace":"github.com/knative/build/pkg/logging.NewLogger\n\t/go/src/github.com/knative/build/pkg/logging/config.go:42\ngithub.com/knative/build/pkg/logging.NewLoggerFromDefaultConfigMap\n\t/go/src/github.com/knative/build/pkg/logging/config.go:51\nmain.main\n\t/go/src/github.com/knative/build/cmd/git-init/main.go:56\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:198"}
{"level":"fatal","ts":1534915561.0484254,"logger":"git-init","caller":"git-init/main.go:66","msg":"Unexpected error creating symlink: symlink /builder/home/.ssh /root/.ssh: file exists","stacktrace":"main.main\n\t/go/src/github.com/knative/build/cmd/git-init/main.go:66\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:198"}

So there are two error logging messages, the second's logging level is fatal, so I assume is the problem. There are three init containers, and the second one failed:

  1. build-step-credential-initializer: completed
  2. build-step-git-source: Error
  3. build-step-build-and-push: waiting

stacktrace one:

Failed to parse the logging config. Falling back to default logger.","error":"empty logging configuration","build.knative.dev/jsonconfig":"","stacktrace":"
github.com/knative/build/pkg/logging.NewLogger
    /go/src/github.com/knative/build/pkg/logging/config.go:42
github.com/knative/build/pkg/logging.NewLoggerFromDefaultConfigMap
    /go/src/github.com/knative/build/pkg/logging/config.go:51
main.main
    /go/src/github.com/knative/build/cmd/git-init/main.go:56
runtime.main
    /usr/local/go/src/runtime/proc.go:198

stacktrace two:

Unexpected error creating symlink: symlink /builder/home/.ssh /root/.ssh: file exists

main.main
    /go/src/github.com/knative/build/cmd/git-init/main.go:66
runtime.main
    /usr/local/go/src/runtime/proc.go:198

Steps to Reproduce the Problem

I'm following the demo at: https://github.com/knative/docs/tree/master/serving/samples/source-to-url-go.

  1. Install the kaniko build template
  2. create secret and ServiceAccount for private docker registry
  3. apply build sample kubectl apply -f service.yaml

Additional Info

The init container image info as:

➜  docker images --no-trunc gcr.io/knative-releases/github.com/knative/build/cmd/git-init
REPOSITORY                                                      TAG                 IMAGE ID                                                                  CREATED             SIZE
gcr.io/knative-releases/github.com/knative/build/cmd/git-init   latest              sha256:5be3a0195544dbf2e34b46797955e5921c34636bb3d9862020ab416e501febc5   10 days ago         2.77GB
fatkun commented 6 years ago

maybe you use pouch, pouch will add a file /root/.ssh/authorized_keys after start, so that the link failed.

cizixs commented 6 years ago

@fatkun Thanks for the tip, I'm using pouch indeed. I think it's better build can handle this situation.