0

I'm new to grafana and prometheus, started working on it from last few days. I'm having some issues. I build a new grafana image and I am using the official helm repo to install it. On using the official image its wotking but on using my image the Pod is showing error. Failed to pull image "my-registry/grafana:9.4.1": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/my-registry/grafana:9.4.1": failed to resolve reference "docker.io/my-registry/grafana:9.4.1": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed On checking I understood that I need to add imagePullSecret but after add that too i'm having the issue. This is where I have added image pull secret

repository: my-registry/grafana
#Overrides the Grafana image tag whose default is the chart appVersion 
 tag: "9.4.1" 
 sha: ""
 pullPolicy: IfNotPresent
#Optionally specify an array of imagePullSecrets.
 #Secrets must be manually created in the namespace.
 #ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
 #Can be templated.
 #pullSecrets:
 #- myRegistrKeySecretName
imagePullSecrets:
-name: secretname

What might be the issue here, any insights will be helpful

Tried adding docker secret with few indentation but still having same issue.

3 Answers 3

1

I'm guessing your problem is the name of the image. I take it that you used your account to create a repository called "my-repository" in Docker Hub? In that case, the name of the image should be:

<your_dockerhub_username>/my-repository

not

my-repository/grafana

unless your Docker Hub username is my-repository and the name of the repository you created was grafana.

To verify this, go to

https://hub.docker.com/repositories/<your_user_name>

where you will see a list of all repositories. Go into the repo you are using there and you will see a Docker command provided that includes the name of your image. Something like:

docker push username/reponame:tagname

That is the image you should be using.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the input, Since I don't want to expose my registry name publically I have given it as my repository. Sorry for make a truble there, I will rename my repository to my registery. for pulling the image I use this command "docker pull my-repository/grafana:9.4.1"
1

As cluster can pull the image from the public registry, I assume you are pulling docker images from a private registry and k8s cluter does not know the secrets. Please follow the following link to provide the required credentials and accesses:

Pull an Image from a Private Registry

8 Comments

Thanks a lot for sharing the document. I have already created the secret. On using kubectl get secret -n namesoace, my secret is listed. I have deployed other componets including prometheus with the smae secret and its work. What i'm facing is the I'm not sure how should i give imagepullsecret in the values file of grafana, I'm using official helm for deploying grafana. Official Helm Repo Line no. 104
I do not think it is related to the helm chart. You mention the image address in the helm chart, k8s looks at your image addresses and tries to authenticate using the type of kubernetes.io/dockerconfigjson secret you provided and tries to log in. Could you pull an image from your private registry or the problem is just with the grafana?
I'm able to pull the images from private registry, I achieve this using the imagePullSecret. But in case of grafana image, I'm not able to pull the image from private repository, So thought its something related with Helm. If its not helm where should I look into. Can you share some insights on this
Does the applied grafana deployment have the imagePullSecret section with the related secret name?
Yes, I will add the few line of code below global: # To help compatibility with other charts which use global.imagePullSecrets. # Allow either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style). # Can be tempalted. # global: # imagePullSecrets: # - name: pullSecret1 # - name: pullSecret2 # or # global: # imagePullSecrets: # - pullSecret1 # - pullSecret2 imagePullSecrets: [] I tried adding here, But I was getting error.
|
0

The error was because I gave imagePullSecret instead of pullSecret, which was mentioned in this file Grafan Helem After correcting it, the issue is solved

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.