<p>I created an image and pushed to dockerHub, from an angular project. I can see that if I will go to localhost:80 it will open the portal. This are the steps:</p>
<pre><code>ng build
docker build -t tiberiu1234/template:v1 .
docker run -rm -d -p 80:80 tiberiu1234/template:v1
</code></pre>
<p>Now I tried to do the same thing but in kubernetes. I created deployment and service and trigger it using the same image:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: portal-deployment
  labels:
    app: portal
spec:
  replicas: 3
  selector:
    matchLabels:
      app: portal
  template:
    metadata:
      labels:
        app: portal
    spec:
      containers:
      - name: portal
        image: tiberiu1234/portal:v1
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: portal-service
spec:
  selector:
    app: portal
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
</code></pre>
<p>Now If I will go and check I will see:</p>
<pre><code>portal-deployment                        0/3     3            0           4m1s
portal-service                                     ClusterIP      10.2.0.114   &lt;none&gt;         80/TCP                       3m56s

portal-deployment-67c6d9bb6c-88cvn                        0/1     ImagePullBackOff   0          23m
portal-deployment-67c6d9bb6c-jrmjz                        0/1     ImagePullBackOff   0          23m
portal-deployment-67c6d9bb6c-wm65h                        0/1     ImagePullBackOff   0          23m
</code></pre>
<p><strong>Error is:</strong>
kubectl logs -f portal-deployment-67c6d9bb6c-88cvn
Error from server (BadRequest): container &quot;portal&quot; in pod &quot;portal-deployment-67c6d9bb6c-88cvn&quot; is waiting to start: <strong>trying and failing to pull image</strong>  and I don't understand why, can you help me with this?</p>

Tiberiu Corneanu
<p>Your repository is private and requires login to pull image.</p>
<p>You need to create a registry credentials secret for kubernetes, as it do not uses docker credentials.</p>
<p>See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/</a></p>
<p>1. Create a secret named regcred:</p>
<pre><code>kubectl create secret docker-registry regcred --docker-server=&lt;your-registry-server&gt; --docker-username=&lt;your-name&gt; --docker-password=&lt;your-pword&gt; --docker-email=&lt;your-email&gt;
</code></pre>
<p>2. Then use this secret in your deployment descriptor:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
...
spec:
  ...
  template:
    spec:
      imagePullSecrets:
        - name: regcred
    ...
</code></pre>
