-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Multi-stage builds fail when run in kind #2164
Comments
Signed-off-by: Andrew Bayer <[email protected]>
Signed-off-by: Andrew Bayer <[email protected]>
The existing `test/e2e-tests-kind.env` is specifically for the `PipelineRun` approach. These new files are for running the e2e tests, via `kind`, in Prow. There are four new env files - one for just the go e2e tests each for `stable` and `alpha`, and one for just the yaml tests each for `stable` and `alpha`. Additionally, `examples/v1beta1/taskruns/git-volume.yaml` is moved to `examples/v1beta1/taskruns/no-ci/git-volume.yaml`. This is because Kind nodes don't have `git` installed, which is necessary for git volumes to work. Also, `--ignore-path=/product_uuid` has been added to the Kaniko args in `examples/v1beta1/pipelineruns/pipelinerun.yaml` and `test/yamls/v1beta1/pipelineruns/pipelinerun.yaml` to work around an issue with Kaniko multi-stage builds on Kind (GoogleContainerTools/kaniko#2164). Signed-off-by: Andrew Bayer <[email protected]>
The existing `test/e2e-tests-kind.env` is specifically for the `PipelineRun` approach. These new files are for running the e2e tests, via `kind`, in Prow. There are four new env files - one for just the go e2e tests each for `stable` and `alpha`, and one for just the yaml tests each for `stable` and `alpha`. Additionally, `examples/v1beta1/taskruns/git-volume.yaml` is moved to `examples/v1beta1/taskruns/no-ci/git-volume.yaml`. This is because Kind nodes don't have `git` installed, which is necessary for git volumes to work. Also, `--ignore-path=/product_uuid` has been added to the Kaniko args in `examples/v1beta1/pipelineruns/pipelinerun.yaml` and `test/yamls/v1beta1/pipelineruns/pipelinerun.yaml` to work around an issue with Kaniko multi-stage builds on Kind (GoogleContainerTools/kaniko#2164). Signed-off-by: Andrew Bayer <[email protected]>
The existing `test/e2e-tests-kind.env` is specifically for the `PipelineRun` approach. These new files are for running the e2e tests, via `kind`, in Prow. There are four new env files - one for just the go e2e tests each for `stable` and `alpha`, and one for just the yaml tests each for `stable` and `alpha`. Additionally, `examples/v1beta1/taskruns/git-volume.yaml` is moved to `examples/v1beta1/taskruns/no-ci/git-volume.yaml`. This is because Kind nodes don't have `git` installed, which is necessary for git volumes to work. Also, `--ignore-path=/product_uuid` has been added to the Kaniko args in `examples/v1beta1/pipelineruns/pipelinerun.yaml` and `test/yamls/v1beta1/pipelineruns/pipelinerun.yaml` to work around an issue with Kaniko multi-stage builds on Kind (GoogleContainerTools/kaniko#2164). Signed-off-by: Andrew Bayer <[email protected]>
The existing `test/e2e-tests-kind.env` is specifically for the `PipelineRun` approach. These new files are for running the e2e tests, via `kind`, in Prow. There are four new env files - one for just the go e2e tests each for `stable` and `alpha`, and one for just the yaml tests each for `stable` and `alpha`. Additionally, `examples/v1beta1/taskruns/git-volume.yaml` is moved to `examples/v1beta1/taskruns/no-ci/git-volume.yaml`. This is because Kind nodes don't have `git` installed, which is necessary for git volumes to work. Also, `--ignore-path=/product_uuid` has been added to the Kaniko args in `examples/v1beta1/pipelineruns/pipelinerun.yaml` and `test/yamls/v1beta1/pipelineruns/pipelinerun.yaml` to work around an issue with Kaniko multi-stage builds on Kind (GoogleContainerTools/kaniko#2164). Signed-off-by: Andrew Bayer <[email protected]>
This error still appear during create multi stage docker image via Kind k8s cluster.
|
Also seeing this same error when building in kind, with |
Same issue |
Same issue with kind and kaniko.
Error:
But it work ok if I run kaniko in docker, not kind. |
I fixed it by add ignorePaths to scaffold yaml:
- image: job-runner
context: ../../
kaniko:
cache: {}
ignorePaths:
- /product_uuid
dockerfile: microservices/job-runner/docker/Dockerfile For normal kaniko cli use arg: |
So I've hit this, and for reliability reasons it was necessary for me to investigate what the cause was. I do not fully understand all the components involved, but I have a working theory. To my understanding Kaniko needs to be able to function without the ability to chroot. This means that in order to execute docker commands, it needs to obliterate the root filesystem of the container its running in. This means that the only places Kaniko can hold state are either in the memory of the build process, or potentially in a filesystem location that is unlikely to conflict with the image being built and also exempt from snapshotting. Looking at kind, it seems that it wants to provide its own versions of the following files:
However, rather than bind-mounting them to individual instances, these are copied into the root-filesystem of the container and then bind-mounted from there. This is mostly inferred from https://github.com/kubernetes-sigs/kind/blob/main/images/base/files/kind/bin/mount-product-files.sh. When Kaniko clears the root filesystem it attempts to delete these files. The bind mounting may explain why they cannot be deleted given that Linux is usually incredibly forgiving of deleting files which are in use. From this I conclude that to ensure Kaniko works correctly, you probably want to ignore both Oddly, I've only seen this issue in CI and not on a local kind deploy. One factor appears to be the host system. Although |
Got exactly same issue but it's random. I'm using the version v1.12.1. But I can't ignore the path in my case, I want to export it in second image |
Seem similar to #1697 (by no solution also in thread) |
Actual behavior
When trying to run a multi-stage build with Kaniko in a kind cluster, specifically of https://github.com/GoogleContainerTools/skaffold/blob/main/examples/microservices/leeroy-web/Dockerfile, it fails with:
EDIT: Interestingly, it seems that adding
--ignore-path=/product_uuid
to the Kaniko args gets rid of the error. I don't know if this is something specific to that file, since I have stumbled across a reference to the exact same error, including//product_uuid
, at https://github.com/mattmoor/mink/blob/b9148a39b2d8bbc69ca9aaf5e89a7613c0b179d8/.github/workflows/minkind-cli.yaml#L150-L155.Expected behavior
I expect multi-stage builds to succeed on kind.
To Reproduce
Steps to reproduce the behavior:
Additional Information
Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: