How to pull docker images hosted on Google Container Registry via Kubernetes (kubernetes included on docker...












1















I am having trouble pulling images from GCR ( pulled by my deployments )
I got ImagePullBackOff error.



I have followed this tutorial already, step by step.



https://container-solutions.com/using-google-container-registry-with-kubernetes/



However it doesn't seem to work for me. I have even tried using the Storage Admin role when creating the service account key but its still no use.



When describing the pod, I got this error:



  Warning  Failed                 14s (x2 over 30s)  kubelet, docker-for-desktop  Failed to pull image "gcr.io/<project-name>/<image-name>": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v2/<project-name>/<image-name>/manifests/latest: unknown: Unable to parse json key.
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Error: ErrImagePull
Normal BackOff 2s (x3 over 29s) kubelet, docker-for-desktop Back-off pulling image "gcr.io/<project-name>/<image-name>"
Warning Failed 2s (x3 over 29s) kubelet, docker-for-desktop Error: ImagePullBackOff


When visiting the https://gcr.io/v2/project-name/image-name/manifests/latest url, I got this:



// 20181124152036
// https://gcr.io/v2/project-name/image-name/manifests/latest

{
"errors": Array[1][
{
"code": "UNAUTHORIZED",
"message": "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"
}
]
}


Pod Definition:



apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-1-deployment
spec:
replicas: 3
selector:
matchLabels:
app: microservice-1
template:
metadata:
labels:
app: microservice-1
spec:
containers:
- name: microservice-1
image: gcr.io/project-name/image-name
ports:
- containerPort: 80


Notes:



My deployments are able to pull images when they where hosted on docker hub, issue only occurs on pulling images in GCR.



Env




  • Windows 10

  • Docker Version 2.0.0.0-win78 (28905)

  • Kubernetes 1.10.3 (Included on docker for desktop)


I hope you can help me on this,



Thanks in advance










share|improve this question

























  • Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

    – David Maze
    Nov 24 '18 at 13:17











  • @DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

    – Jplus2
    Nov 25 '18 at 5:17
















1















I am having trouble pulling images from GCR ( pulled by my deployments )
I got ImagePullBackOff error.



I have followed this tutorial already, step by step.



https://container-solutions.com/using-google-container-registry-with-kubernetes/



However it doesn't seem to work for me. I have even tried using the Storage Admin role when creating the service account key but its still no use.



When describing the pod, I got this error:



  Warning  Failed                 14s (x2 over 30s)  kubelet, docker-for-desktop  Failed to pull image "gcr.io/<project-name>/<image-name>": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v2/<project-name>/<image-name>/manifests/latest: unknown: Unable to parse json key.
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Error: ErrImagePull
Normal BackOff 2s (x3 over 29s) kubelet, docker-for-desktop Back-off pulling image "gcr.io/<project-name>/<image-name>"
Warning Failed 2s (x3 over 29s) kubelet, docker-for-desktop Error: ImagePullBackOff


When visiting the https://gcr.io/v2/project-name/image-name/manifests/latest url, I got this:



// 20181124152036
// https://gcr.io/v2/project-name/image-name/manifests/latest

{
"errors": Array[1][
{
"code": "UNAUTHORIZED",
"message": "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"
}
]
}


Pod Definition:



apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-1-deployment
spec:
replicas: 3
selector:
matchLabels:
app: microservice-1
template:
metadata:
labels:
app: microservice-1
spec:
containers:
- name: microservice-1
image: gcr.io/project-name/image-name
ports:
- containerPort: 80


Notes:



My deployments are able to pull images when they where hosted on docker hub, issue only occurs on pulling images in GCR.



Env




  • Windows 10

  • Docker Version 2.0.0.0-win78 (28905)

  • Kubernetes 1.10.3 (Included on docker for desktop)


I hope you can help me on this,



Thanks in advance










share|improve this question

























  • Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

    – David Maze
    Nov 24 '18 at 13:17











  • @DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

    – Jplus2
    Nov 25 '18 at 5:17














1












1








1








I am having trouble pulling images from GCR ( pulled by my deployments )
I got ImagePullBackOff error.



I have followed this tutorial already, step by step.



https://container-solutions.com/using-google-container-registry-with-kubernetes/



However it doesn't seem to work for me. I have even tried using the Storage Admin role when creating the service account key but its still no use.



When describing the pod, I got this error:



  Warning  Failed                 14s (x2 over 30s)  kubelet, docker-for-desktop  Failed to pull image "gcr.io/<project-name>/<image-name>": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v2/<project-name>/<image-name>/manifests/latest: unknown: Unable to parse json key.
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Error: ErrImagePull
Normal BackOff 2s (x3 over 29s) kubelet, docker-for-desktop Back-off pulling image "gcr.io/<project-name>/<image-name>"
Warning Failed 2s (x3 over 29s) kubelet, docker-for-desktop Error: ImagePullBackOff


When visiting the https://gcr.io/v2/project-name/image-name/manifests/latest url, I got this:



// 20181124152036
// https://gcr.io/v2/project-name/image-name/manifests/latest

{
"errors": Array[1][
{
"code": "UNAUTHORIZED",
"message": "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"
}
]
}


Pod Definition:



apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-1-deployment
spec:
replicas: 3
selector:
matchLabels:
app: microservice-1
template:
metadata:
labels:
app: microservice-1
spec:
containers:
- name: microservice-1
image: gcr.io/project-name/image-name
ports:
- containerPort: 80


Notes:



My deployments are able to pull images when they where hosted on docker hub, issue only occurs on pulling images in GCR.



Env




  • Windows 10

  • Docker Version 2.0.0.0-win78 (28905)

  • Kubernetes 1.10.3 (Included on docker for desktop)


I hope you can help me on this,



Thanks in advance










share|improve this question
















I am having trouble pulling images from GCR ( pulled by my deployments )
I got ImagePullBackOff error.



I have followed this tutorial already, step by step.



https://container-solutions.com/using-google-container-registry-with-kubernetes/



However it doesn't seem to work for me. I have even tried using the Storage Admin role when creating the service account key but its still no use.



When describing the pod, I got this error:



  Warning  Failed                 14s (x2 over 30s)  kubelet, docker-for-desktop  Failed to pull image "gcr.io/<project-name>/<image-name>": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v2/<project-name>/<image-name>/manifests/latest: unknown: Unable to parse json key.
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Error: ErrImagePull
Normal BackOff 2s (x3 over 29s) kubelet, docker-for-desktop Back-off pulling image "gcr.io/<project-name>/<image-name>"
Warning Failed 2s (x3 over 29s) kubelet, docker-for-desktop Error: ImagePullBackOff


When visiting the https://gcr.io/v2/project-name/image-name/manifests/latest url, I got this:



// 20181124152036
// https://gcr.io/v2/project-name/image-name/manifests/latest

{
"errors": Array[1][
{
"code": "UNAUTHORIZED",
"message": "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"
}
]
}


Pod Definition:



apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-1-deployment
spec:
replicas: 3
selector:
matchLabels:
app: microservice-1
template:
metadata:
labels:
app: microservice-1
spec:
containers:
- name: microservice-1
image: gcr.io/project-name/image-name
ports:
- containerPort: 80


Notes:



My deployments are able to pull images when they where hosted on docker hub, issue only occurs on pulling images in GCR.



Env




  • Windows 10

  • Docker Version 2.0.0.0-win78 (28905)

  • Kubernetes 1.10.3 (Included on docker for desktop)


I hope you can help me on this,



Thanks in advance







docker kubernetes docker-for-windows google-container-registry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 5:15







Jplus2

















asked Nov 24 '18 at 7:28









Jplus2Jplus2

5931027




5931027













  • Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

    – David Maze
    Nov 24 '18 at 13:17











  • @DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

    – Jplus2
    Nov 25 '18 at 5:17



















  • Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

    – David Maze
    Nov 24 '18 at 13:17











  • @DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

    – Jplus2
    Nov 25 '18 at 5:17

















Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

– David Maze
Nov 24 '18 at 13:17





Can you include your Pod or Deployment spec in the question? Assuming you have an imagePullSecret, how did you create it?

– David Maze
Nov 24 '18 at 13:17













@DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

– Jplus2
Nov 25 '18 at 5:17





@DavidMaze done. I'm still trying to debug this issue. Also if you are going to provide an answer, can you make it a clear step by step process to its crystal not just for me but for others as well. Thanks in advance.

– Jplus2
Nov 25 '18 at 5:17












2 Answers
2






active

oldest

votes


















1














OK found the culprit, it has something to do with Powershell and Command Prompt.



I switched to using Git Bash and followed the same instructions in this tutorial



https://container-solutions.com/using-google-container-registry-with-kubernetes/



and it worked!



Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.



Hope this helps anyone.






share|improve this answer































    0














    Looking at the error message it looks like that the json file you have provided has some issue unable to parse json file



    The reason behind that is the json file you have has break (newline) in it and hence unable to recognise in secret.



    Please have a look here and try one of the solution. You can always choose other authentication methods listed here



    Docker Login to gcr.io in Powershell



    Hope this helps.






    share|improve this answer
























    • Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

      – Jplus2
      Nov 25 '18 at 5:11











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456117%2fhow-to-pull-docker-images-hosted-on-google-container-registry-via-kubernetes-ku%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    OK found the culprit, it has something to do with Powershell and Command Prompt.



    I switched to using Git Bash and followed the same instructions in this tutorial



    https://container-solutions.com/using-google-container-registry-with-kubernetes/



    and it worked!



    Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.



    Hope this helps anyone.






    share|improve this answer




























      1














      OK found the culprit, it has something to do with Powershell and Command Prompt.



      I switched to using Git Bash and followed the same instructions in this tutorial



      https://container-solutions.com/using-google-container-registry-with-kubernetes/



      and it worked!



      Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.



      Hope this helps anyone.






      share|improve this answer


























        1












        1








        1







        OK found the culprit, it has something to do with Powershell and Command Prompt.



        I switched to using Git Bash and followed the same instructions in this tutorial



        https://container-solutions.com/using-google-container-registry-with-kubernetes/



        and it worked!



        Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.



        Hope this helps anyone.






        share|improve this answer













        OK found the culprit, it has something to do with Powershell and Command Prompt.



        I switched to using Git Bash and followed the same instructions in this tutorial



        https://container-solutions.com/using-google-container-registry-with-kubernetes/



        and it worked!



        Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.



        Hope this helps anyone.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 0:03









        Jplus2Jplus2

        5931027




        5931027

























            0














            Looking at the error message it looks like that the json file you have provided has some issue unable to parse json file



            The reason behind that is the json file you have has break (newline) in it and hence unable to recognise in secret.



            Please have a look here and try one of the solution. You can always choose other authentication methods listed here



            Docker Login to gcr.io in Powershell



            Hope this helps.






            share|improve this answer
























            • Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

              – Jplus2
              Nov 25 '18 at 5:11
















            0














            Looking at the error message it looks like that the json file you have provided has some issue unable to parse json file



            The reason behind that is the json file you have has break (newline) in it and hence unable to recognise in secret.



            Please have a look here and try one of the solution. You can always choose other authentication methods listed here



            Docker Login to gcr.io in Powershell



            Hope this helps.






            share|improve this answer
























            • Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

              – Jplus2
              Nov 25 '18 at 5:11














            0












            0








            0







            Looking at the error message it looks like that the json file you have provided has some issue unable to parse json file



            The reason behind that is the json file you have has break (newline) in it and hence unable to recognise in secret.



            Please have a look here and try one of the solution. You can always choose other authentication methods listed here



            Docker Login to gcr.io in Powershell



            Hope this helps.






            share|improve this answer













            Looking at the error message it looks like that the json file you have provided has some issue unable to parse json file



            The reason behind that is the json file you have has break (newline) in it and hence unable to recognise in secret.



            Please have a look here and try one of the solution. You can always choose other authentication methods listed here



            Docker Login to gcr.io in Powershell



            Hope this helps.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 24 '18 at 12:50









            Prafull LadhaPrafull Ladha

            2,739320




            2,739320













            • Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

              – Jplus2
              Nov 25 '18 at 5:11



















            • Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

              – Jplus2
              Nov 25 '18 at 5:11

















            Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

            – Jplus2
            Nov 25 '18 at 5:11





            Unfortunately It didn't work for me, same issue. I have tried to follow the instructions here stackoverflow.com/questions/48310486/…, still couldn't make it work. I even tried manually removing all line breaks to the json file, still no good. Also if all is good, can you provide step by step process of your suggested solution so its clear not just for me but for others as well. I am still trying to debug this issue.

            – Jplus2
            Nov 25 '18 at 5:11


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456117%2fhow-to-pull-docker-images-hosted-on-google-container-registry-via-kubernetes-ku%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks