<p>When I try to create Deployment as Type Job, it's not pulling any image. </p>

<p>Below is .yaml:</p>

<pre>
apiVersion: batch/v1
kind: Job
metadata:
  name: copyartifacts
spec:
  backoffLimit: 1
  template:
    metadata:
      name: copyartifacts
    spec:
      restartPolicy: "Never"
      volumes:
      - name: sharedvolume
        persistentVolumeClaim:
          claimName: shared-pvc
      - name: dockersocket
        hostPath:
          path: /var/run/docker.sock
      containers:
      - name: copyartifacts
        image: alpine:3.7
        imagePullPolicy: Always
        command: ["sh", "-c", "ls -l /shared; rm -rf /shared/*; ls -l /shared; while [ ! -d /shared/artifacts ]; do echo Waiting for artifacts to be copied; sleep 2; done; sleep 10; ls -l /shared/artifacts; "]
        volumeMounts:
        - mountPath: /shared
          name: sharedvolume

</pre>

<p>Can you please guide here?</p>

<p>Regards,
Vikas</p>

Vikas Banage
<p>There could be two possible reasons for not seeing pod.</p>

<ol>
<li>The pod hasn't been created yet.</li>
<li>The pod has completed it's task and terminated before you have noticed.</li>
</ol>

<p><strong>1. Pod hasn't been created:</strong></p>

<p>If pod hasn't been created yet, you have to find out why the job failed to create pod. You can view job's events to see if there are any failure event. Use following command to describe a job.</p>

<pre><code>kubectl describe job &lt;job-name&gt; -n &lt;namespace&gt;
</code></pre>

<p>Then, check the <code>Events:</code> field. There might be some events showing pod creation failure with respective reason.</p>

<p><strong>2. Pod has completed and terminated:</strong></p>

<p>Job's are used to  perform one-time task rather than serving an application that require to maintain a desired state. When the task is complete, pod goes to completed state then terminate (but not deleted). If your Job is intended for a task that does not take much time, the pod may terminate after completing the task before you have noticed.</p>

<p>As the pod is terminated, <code>kubectl get pods</code> will not show that pod. However, you will able to see the pod using <code>kubectl get pods -a</code> command as it hasn't been deleted.</p>

<p>You can also describe the job and check for completion or success event.</p>
