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

Error on pushing image to GCR #1791

Closed
vasyan1992 opened this issue Oct 20, 2021 · 30 comments
Closed

Error on pushing image to GCR #1791

vasyan1992 opened this issue Oct 20, 2021 · 30 comments
Assignees
Labels
area/authentication area/registry For all bugs having to do with pushing/pulling into registries fixed-needs-verfication norepro core team can't replicate this issue, require more info priority/p0 Highest priority. Break user flow. We are actively looking at delivering it. registry/gcr regression/v1.6.0 regression
Milestone

Comments

@vasyan1992
Copy link

Actual behavior
Getting an error on kaniko with GCR after latest update (version 28a6bdc-debug
1.7.0-debug)

Expected behavior
image a0c96b4-debug is OK (ver 1.6.0-debug)

To Reproduce
printf $REGISTRY_ACCESSKEY > ${CI_PROJECT_DIR}/gcr.json
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile ./Dockerfile --destination ${IMAGE}

Additional Information

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@amity0
Copy link

amity0 commented Oct 20, 2021

Also getting this error

@SirPhemmiey
Copy link

Having this issue also!!!

@lienerieksta
Copy link

Using Workload Identity to push images to GCR is producing the same error as OP posted.

@rushilsrivastava
Copy link

Seeing this error as well.

@nielsbox
Copy link

Dupe of #1786

@amichal
Copy link

amichal commented Oct 20, 2021

I posed on the dupe but I'm wondering if its somehow here cf4822c

@Keramblock
Copy link

Keramblock commented Oct 20, 2021

Same, downgraded to 1.6.0 - fixed issue for me =(

@eremeevfd
Copy link

We are facing this issue as well

@dhpollack
Copy link

Same here. Using v1.6.0 instead of latest solved the problem for me

@dannyvanl
Copy link

Same issue for us this morning. Rolling back to 1.6.0 solved it for now.

@Foxinou35
Copy link

Same issue here :/ Workaround worked thanks
PS : lost several hours checking and checking the roles on my service account ^^

@gmega
Copy link

gmega commented Oct 20, 2021

Same here, looks like this could be a regression of #1242.

@tejal29
Copy link
Member

tejal29 commented Oct 20, 2021

Thanks fix is the way! #1794

@Billcountry
Copy link

Having this issue too. Had to tie down the version v1.6.0

@Tarang
Copy link

Tarang commented Oct 21, 2021

is this live yet?

@Richard87
Copy link

Sam error happend to me as well, but downgrading to v.1.6.0 did not solve the error :/

@nicolas-goudry
Copy link

Same issue here.
A workaround to use 1.7.0 with GCR using a service account is to use the .docker/config.json method providing following credentials:

$ mkdir -p /kaniko/.docker
$ echo "{\"auths\":{\"gcr.io\":{\"auth\":\"$(echo -n _json_key:$(cat service-account-key.json) | base64 | tr -d "\n")\"}}}" > /kaniko/.docker/config.json

@jmuleiro
Copy link

Same issue here, using Kaniko for test environments, all build pipelines were broken. Temporarily fixed with rollback to version 1.6.0.

@mattstrain
Copy link

Same issue with image builds on gitlab runner in GKE using workload identity auth.

@corveen
Copy link

corveen commented Oct 22, 2021

I am using gcloud to build dockers.

gcloud config set builds/use_kaniko True

Is there a workaround or way to downgrade to 1.6.0?
Because it seems that gcloud always uses gcr.io/kaniko-project/executor:latest

@mareksuscak
Copy link

mareksuscak commented Oct 22, 2021

@corveen and anyone who's struggling with this regression that's been introduced and left unsolved 3 days ago (yes, unbelievable) along with another regression in gcloud CLI preventing AppEngine deploys that has been introduced on the same day in SDK 361.0.0 and has not been addressed to this day either, here's what we did:

  1. Add cloudbuild.yml (see below) to the root of your project

    # cloudbuild.yml
    
    steps:
      # TODO: revert to :latest tag once the following issue is closed:
      # https://github.com/GoogleContainerTools/kaniko/issues/1786
      - name: 'gcr.io/kaniko-project/executor:v1.6.0'
        id: 'Build and push container image'
        args:
          [
            '--destination=${_IMAGE}',
            '--cache=true',
            '--cache-ttl=6h'
          ]
    
    timeout: 1800s
    
  2. Rewrite your deployment script as follows:

    IMAGE=us.gcr.io/your-project-id/your-image:your-tag
    - gcloud builds submit --tag $IMAGE
    + gcloud builds submit --substitutions _IMAGE=$IMAGE
  3. Pin gcloud SDK to the version 360.0.0 for the time being

This is the equivalent of using gcloud builds submit --tag and gives you full control over the version of Kaniko and other parameters.

Relevant documentation that helped us solve this issue:

dancerj added a commit to dancerj/gitlstreefs that referenced this issue Oct 31, 2021
This reverts commit 45c2dd5.

I believe the latest is now pointing back to 1.6 until the proper fix is landed.

GoogleContainerTools/kaniko#1791
GoogleContainerTools/kaniko#1794
@stefpb
Copy link

stefpb commented Dec 21, 2021

Keeping version 1.6 is now the answer? Why no one revert this 1.7 version?

@imjasonh
Copy link
Collaborator

Keeping version 1.6 is now the answer? Why no one revert this 1.7 version?

The current :latest used by gcloud points to 1.6.0, since there was a bug in 1.7.0.

@kaaboaye
Copy link

kaaboaye commented Dec 21, 2021 via email

@rwong2888
Copy link

@stefpb , @imjasonh

I was able to use 1.7.0 by mounting a docker config using the SA creds

https://issueexplorer.com/issue/GoogleContainerTools/kaniko/1791#10012106

https://webcache.googleusercontent.com/search?q=cache:jx9iGg75zJcJ:https://issueexplorer.com/issue/GoogleContainerTools/kaniko/1791+&cd=1&hl=en&ct=clnk&gl=us

nicolas-goudry wrote this answer on 2021-10-21
Same issue here.
A workaround to use 1.7.0 with GCR using a service account is to use the .docker/config.json method providing following credentials:
$ mkdir -p /kaniko/.docker
$ echo "{"auths":{"gcr.io":{"auth":"$(echo -n _json_key:$(cat service-account-key.json) | base64 | tr -d "\n")"}}}" > /kaniko/.docker/config.json

@Keramblock latest got reverted to 1.6.0 due to issues

@hudac
Copy link

hudac commented Apr 29, 2022

Also tested v1.8.0 and v1.8.1, same issue. Reverted back to v1.6.0, now it works :/

@kdaghay
Copy link

kdaghay commented Mar 7, 2023

Still an issue when using 1.9.1. Used @nicolas-goudry's suggestion which works.

#1791 (comment)

Same issue here. A workaround to use 1.7.0 with GCR using a service account is to use the .docker/config.json method providing following credentials:

$ mkdir -p /kaniko/.docker
$ echo "{\"auths\":{\"gcr.io\":{\"auth\":\"$(echo -n _json_key:$(cat service-account-key.json) | base64 | tr -d "\n")\"}}}" > /kaniko/.docker/config.json

@aaron-prindle
Copy link
Collaborator

aaron-prindle commented Jul 15, 2023

Can anyone here comment on if this issue is still occuring for them w/ the latest version of Kaniko v1.12.1 and any specific repro steps that can be done to replicate this? I have tested uploading images to GCR w/ Kaniko (using gcr.io domain) using both a json service account key w/ GCR push perms as well as by setting up Workload Identity w/ a service account w/ GCR push perms and Kaniko is successfully uploading images in both cases. Happy to dig into this more if someone else here can provide additional repro details. Thanks

@aaron-prindle aaron-prindle added fixed-needs-verfication norepro core team can't replicate this issue, require more info labels Jul 15, 2023
@hudac
Copy link

hudac commented Jul 15, 2023

I can't reproduce this issue anymore. We are using v1.9.2 (and testing v1.12), no issue so far.

In our case, this was a configuration issue. We are using GCR auth via workload identity. Till v1.6 we had to provide a Docker config file (/kaniko/.docker/config.json), like this one:

{
  "credHelpers": {
    "eu.gcr.io": "gcr",
    "gcr.io": "gcr"
  }
}

Since at least v1.8 (maybe even v1.7) you don't need, actually you cannot have this Docker config file anymore. If this file is present, Kaniko v1.8 or newer fails with an auth error as reported in this issue. And vice versa, v1.6 does not work without the config file above.

If you are using the newest version of Kaniko with GCR and workload identities, omit the Docker config file. Keeping an empty one {} also works.

@aaron-prindle aaron-prindle self-assigned this Nov 6, 2023
@aaron-prindle aaron-prindle added this to the v1.19.0 milestone Nov 6, 2023
@aaron-prindle
Copy link
Collaborator

Thanks @hudac, closing this issue as I believe this is resolved @ HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/authentication area/registry For all bugs having to do with pushing/pulling into registries fixed-needs-verfication norepro core team can't replicate this issue, require more info priority/p0 Highest priority. Break user flow. We are actively looking at delivering it. registry/gcr regression/v1.6.0 regression
Projects
None yet
Development

No branches or pull requests