<p>I know a lot of people already had similar question, i read a few of them, but found nothing what actualy helped me so far.</p>

<p>I have a gitlab with private repo enabled, I also use Google Kubernetes Engine. I have a few Docker container in my private repo, and I want to deploy one of them to the Kubernetes Engine.</p>

<p>I have created a secret with <code>kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt</code>
I also tried <code>kubectl create secret docker-registry name --docker-server=registry.xy.z --docker-username=google --docker-password=xyz --docker-email=xy@z.de</code>
Then I created my Deployment file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: backend-test
labels:
app: 13371337
spec:
replicas: 1
template:
metadata:
labels:
app: 13371337
spec:
  containers:
  - name: backend
    image: registry.xy.z/group/project/backend:latest
    imagePullPolicy: Always
    ports:
    - containerPort: 8080
  imagePullSecrets:
  - name: db-user-pass or name
</code></pre>

<p>Any ideas how to get it running?</p>

<p>Using <code>kubectl create secret docker-registry name</code> is a <a href="https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod" rel="noreferrer">right way</a> to provide credentials of private docker registry.</p>

<p><code>imagePullSecrets</code> options looking good too, if you specify there a name of your docker-registry secret.</p>

<p>So, from Kubernetes path everything looking good.</p>

<p>Try to check events of the pod which will be created by Deployment, just find you pod by <code>kubectl get pods</code> and call <code>kubectl describe pod $name_of_your_pod</code>, you will see an actual reason why it cannot pull an image.</p>

<p>Also, if your depository is insecure or has self-signed certificate, try to follow <a href="https://docs.docker.com/registry/insecure/#deploy-a-plain-http-registry" rel="noreferrer">that guide</a> to allow docker daemon pulling image from there, that is an often reason of image pull failures.</p>
