简体   繁体   中英

Kubernetes not pulling image from JFrog private registry

I'm using JFrog repository as my private registry. And I have specified the secret in order to authenticate with the JFrog. But it says

Failed to pull image "private_registry/image_name": rpc error: code = Unknown desc = failed to pull and unpack image "private_registry/image_name": failed to resolve reference "": failed to authorize: failed to fetch oauth token: unexpected status: 401 Unauthorized
  Warning  Failed     2s (x2 over 14s)  kubelet, worker-0  Error: ErrImagePull

Pod-Def.yml

I have created a secret file too. But still it doesn't pull the image. When I do docker image pull private_registry/image_name the image get pulled.

From the question, it's clear that it's not able to authenticate for some reason, It could be a misconfiguration of the secret also possible that the credential used is/are not valid.

Since the secret.yaml file is not present, not aware of the format.

In this case, I would suggest looking at 2 things

  1. Check if the credentials are correct. (In this case, probably you can use docker pull after docker login with the same credential)

If you are able to pull the image successfully, take a look at the next point.

  1. In this, you have the check the way you configure or pass the credentials in the chart is correct.

There are different ways to pass credentials in different cases, you can take a look at this official doc. and here in devops exchange the answer also might help to get some insight.

and here is how my secret.yaml looks like:

---
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Chart.Name }}-docker-credentials
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ .Chart.Name }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
type: kubernetes.io/dockercfg
data:
  .dockercfg: {{ "{\".Values.REGISTRY.URL>>/\":{\"username\":\".Values.REGISTRY.USER_NAME>>\",\"password\":\".Values.REGISTRY.PASSWORD>>\",\"email\":\".Values.REGISTRY.EMAIL>>\",\"auth\":\".Values.REGISTRY.AUTH_TOKEN>>\"}}" | b64enc | quote }}


in the deployments i do:

spec:
   imagePullSecrets:
      - name: {{ .Chart.Name }}-docker-credentials

Since you have already resolved, hope this would help someone else.😃

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM