i have setup a private registry in docker accessible thru a domain “makdom.ddns.net”, i can login push and pull images locally, no problem even from slave kubes node i can do this thing,

but when i write a kubes deployment file, it is unable to pull images from the private registry and fails.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ssh-deployment
spec:
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - name: ssh-demo
        image: makdom.ddns.net/my-ubuntu
        imagePullPolicy: IfNotPresent
        ports:
        - name: nodejs-port
          containerPort: 22
      imagePullSecrets:
      - name: myregistrykey

secrets:

DOCKER_REGISTRY_SERVER="https://makdom.ddns.net/v1/"
DOCKER_USER="user"
DOCKER_PASSWORD="password"
DOCKER_EMAIL="email@example.com" 

kubectl create secret docker-registry myregistrykey \
  --docker-server=$DOCKER_REGISTRY_SERVER \
  --docker-username=$DOCKER_USER \
  --docker-password=$DOCKER_PASSWORD \
  --docker-email=$DOCKER_EMAIL  

error:

Events:
  Type     Reason                 Age               From                  Message
  ----     ------                 ----              ----                  -------
  Normal   Scheduled              1m                default-scheduler     Successfully assigned ssh-deployment-7b7c7bf977-m6stk to kubes-slave
  Normal   SuccessfulMountVolume  1m                kubelet, kubes-slave  MountVolume.SetUp succeeded for volume "default-token-mx7qq"
  Normal   Pulled                 1m (x3 over 1m)   kubelet, kubes-slave  Container image "makdom.ddns.net/my-ubuntu" already present on machine
  Normal   Created                1m (x3 over 1m)   kubelet, kubes-slave  Created container
  Normal   Started                1m (x3 over 1m)   kubelet, kubes-slave  Started container
  Normal   Pulling                34s (x2 over 1m)  kubelet, kubes-slave  pulling image "makdom.ddns.net/my-ubuntu"
  Warning  Failed                 34s (x2 over 1m)  kubelet, kubes-slave  Failed to pull image "makdom.ddns.net/my-ubuntu": rpc error: code = Unknown desc = Error: image my-ubuntu:latest not found
  Warning  Failed                 34s (x2 over 1m)  kubelet, kubes-slave  Error: ErrImagePull
  Warning  BackOff                19s (x6 over 1m)  kubelet, kubes-slave  Back-off restarting failed container
up vote 1 down vote accepted

Known issue https://github.com/kubernetes/kubernetes/issues/57427, resolved in master in https://github.com/kubernetes/kubernetes/pull/57463

Targeted fix for 1.9.1 in https://github.com/kubernetes/kubernetes/pull/57472

Workarounds until then:

If you have a .dockerconfigjson for your private registry already, you can manually specify the type and data key:

kubectl create secret generic my-secret-name \
  --type=kubernetes.io/dockerconfigjson \
  --from-file .dockerconfigjson=/path/to/.dockerconfigjson

If you don't have a .dockerconfigjson file already, you can fix up the secret produced by kubectl create secret docker-registry manually:

  1. add --dry-run -o yaml > secret.yaml
  2. change the type from kubernetes.io/dockercfg to kubernetes.io/dockercfgjson
  3. change the data key from .dockercfg to .dockercfgjson
  4. create the modified secret with kubectl create -f secret.yaml
  • ok how can i fix this, as im a little lost! – Mohd Dec 24 '17 at 3:20

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.