<p>Found the issue, had:</p>
<pre><code>kubectl -n jenkins patch serviceaccount jenkins -p '{&quot;imagePullSecrets&quot;: [{&quot;name&quot;: &quot;gcr-json-key&quot;}]}' 
</code></pre>
<p>... applied on <code>default</code> serviceaccount instead of <code>jenkins</code>.</p>

CC BY-SA 4.0
2020-08-14T14:23:47.277Z
2020-09-14T09:28:44.837Z
2020-09-14T09:28:44.837Z
anVzdGFub3RoZXJodW1hbg
<p>I am failing to pull images from a private gcr repo through helm jenkins on a private k8s repo. I am getting:</p>
<blockquote>
<p>rpc error: code = Unknown desc = Error response from daemon: unauthorized: 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: <a href="https://cloud.google.com/container-registry/docs/advanced-authentication" rel="nofollow noreferrer">https://cloud.google.com/container-registry/docs/advanced-authentication</a>.</p>
</blockquote>
<p>Is there anyway I can mitigate this error without specifically specifying credentials on pipeline level?</p>
<p>Pulling image from host work and creating a deployment in K8s is pulling successfully, but when pulled within Jenkins it doesn't work.</p>

<jenkins><kubernetes><docker-registry>
Jenkins Helm Chart - kubernetes-plugin pulling image from a private gcr
anVzdGFub3RoZXJodW1hbg
# Jenkins Helm Chart - kubernetes-plugin pulling image from a private gcr

(Asked by: username_0 on 2020-08-14)

I am failing to pull images from a private gcr repo through helm jenkins on a private k8s repo. I am getting:

> rpc error: code = Unknown desc = Error response from daemon: unauthorized: 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>.

Is there anyway I can mitigate this error without specifically specifying credentials on pipeline level?

Pulling image from host work and creating a deployment in K8s is pulling successfully, but when pulled within Jenkins it doesn't work.

**Tags:** jenkins, kubernetes, docker-registry


---

## 1 answers

### Answer by username_0 on 2020-08-14. Score: 1 | Accepted answer

Found the issue, had:
kubectl -n jenkins patch serviceaccount jenkins -p '{"imagePullSecrets": [{"name": "gcr-json-key"}]}' 

... applied on default serviceaccount instead of jenkins.


---

