<p>Hello kubernetes developers,</p>

<p>i get the error 'ImagePullBackOff' if deploy a pod in kubernetes. 
Pulling in docker to get the image from git-hub repository is no problem. But what is wrong with my configuration?</p>

<p>I tried this workaround to create a secret-key with the following command.</p>

<pre><code>kubectl create secret docker-registry secretkey \
        --docker-server=registry.hub.docker.com \
        --docker-username=reponame \
        --docker-password=repopassword \
        --docker-email=repoemail
</code></pre>

<p>And this is the yaml file to create the kubernetes pod.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: gps-restful-server
  name: gps-restful-server
spec:
  containers:
  - image: tux/gps:latest
    name: gps-restful-server
    ports:
    - containerPort: 8080
    resources: {}
    volumeMounts:
    - mountPath: /var/www/html/modules
      name: gps-modules
    - mountPath: /var/www/html/profiles
      name: gps-profile
    - mountPath: /var/www/html/themes
      name: gps-theme
    - mountPath: /var/www/html/sites
      name: gps-sites
    imagePullPolicy: Always
  restartPolicy: OnFailure
  imagePullSecrets:
    - name: secretkey
  volumes:
  - name: gps-modules
    persistentVolumeClaim:
      claimName: gps-modules
  - name: gps-profile
    persistentVolumeClaim:
      claimName: gps-profile
  - name: gps-theme
    persistentVolumeClaim:
      claimName: gps-theme
  - name: gps-sites
    persistentVolumeClaim:
      claimName: gps-sites
status: {}
</code></pre>

<p>To deploy the pod in kubernetes, i execute the command: </p>

<pre><code>kubectl create -f gps-restful-server-pod.yaml.
</code></pre>

<p>Get the status from the pod:</p>

<pre><code>kubectl get all
NAME                           READY     STATUS             RESTARTS   AGE
pod/telemetry-restful-server   0/1       ImagePullBackOff   0          12m  
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
service/kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP    1h
</code></pre>

<p>Description of the pod:</p>

<pre><code>kubectl describe pod gps-restful-server
Name:               gps-restful-server
Namespace:          default
Priority:           0
PriorityClassName:  &lt;none&gt;
Node:               minikube/192.168.178.92
Start Time:         Thu, 14 Feb 2019 16:56:25 +0100
Labels:             io.kompose.service=gps-restful-server
Annotations:        &lt;none&gt;
Status:             Pending
IP:                 172.17.0.3
Containers:
  gps-restful-server:
    Container ID:
    Image:          tux/gps:latest
    Image ID:
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4t28k (ro)
      /var/www/html/modules from gps-modules (rw)
      /var/www/html/profiles from gps-profile (rw)
      /var/www/html/sites from gps-sites (rw)
      /var/www/html/themes from gps-theme (rw)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  gps-modules:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  gps-modules
    ReadOnly:   false
  gps-profile:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  gps-profile
    ReadOnly:   false
  gps-theme:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  gps-theme
    ReadOnly:   false
  gps-sites:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  gps-sites
    ReadOnly:   false
  default-token-4t28k:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-4t28k
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age              From               Message
  ----     ------     ----             ----               -------
  Normal   Scheduled  4m               default-scheduler  Successfully assigned default/gps-restful-server to minikube
  Normal   Pulling    2m (x4 over 4m)  kubelet, minikube  pulling image "tux/gps:latest"
  Warning  Failed     2m (x4 over 4m)  kubelet, minikube  Failed to pull image "tux/gps:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for tux/gps, repository does not exist or may require 'docker login'
  Warning  Failed     2m (x4 over 4m)  kubelet, minikube  Error: ErrImagePull
  Warning  Failed     2m (x6 over 4m)  kubelet, minikube  Error: ImagePullBackOff
  Normal   BackOff    2m (x7 over 4m)  kubelet, minikube  Back-off pulling image "tux/gps:latest"
</code></pre>

<p>How it's possible to pull the image from docker-hub in kubernetes?</p>

<p>The Image tux/gps:latest does not exist because its a dummy value.
Solution to ImagePullBackoff: </p>

<ol>
<li>Make sure that your Image points to latest version repouser/reponame:latest</li>
<li>Create a secret docker-registry (look above)</li>
<li>Server address[<a href="https://index.docker.io/v1/" rel="nofollow noreferrer">docker-hub registry</a>]</li>
<li>Add the following propertie in pod yaml file (look above):</li>
</ol>

<p>imagePullSecrets:<br>
  - name: secretkey</p>
