<p>I created a docker image of my app which is running an internal server exposed at 8080.
Then I tried to create a local kubernetes cluster for testing, using the following set of commands.</p>
<pre><code>$ kubectl create deployment --image=test-image test-app
$ kubectl set env deployment/test-app DOMAIN=cluster
$ kubectl expose deployment test-app --port=8080 --name=test-service
</code></pre>
<p>I am using Docker-desktop on windows to run run kubernetes. This exposes my cluster to external IP <code>localhost</code> but i cannot access my app. I checked the status of the pods and noticed this issue:</p>
<pre><code>$ kubectl get pods
 NAME         READY   STATUS             RESTARTS   AGE
test-66-ps2   0/1     ImagePullBackOff   0          8h
test-6f-6jh   0/1     InvalidImageName   0          7h42m
</code></pre>
<p>May I know what could be causing this issue? And how can i make it work on local ?
Thanks, Look forward to the suggestions!</p>
<p>My YAML file for reference:</p>
<pre class="lang-js prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: &quot;4&quot;
  creationTimestamp: &quot;2021-10-13T18:00:15Z&quot;
  generation: 4
  labels:
    app: test-app
  name: test-app
  namespace: default
  resourceVersion: &quot;*****&quot;
  uid: ************
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: test-app
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: test-app
    spec:
      containers:
      - env:
        - name: DOMAIN
          value: cluster
        image: C:\Users\test-image
        imagePullPolicy: Always
        name: e20f23453f27
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  conditions:
  - lastTransitionTime: &quot;2021-10-13T18:00:15Z&quot;
    lastUpdateTime: &quot;2021-10-13T18:00:15Z&quot;
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: &quot;False&quot;
    type: Available
  - lastTransitionTime: &quot;2021-10-13T18:39:51Z&quot;
    lastUpdateTime: &quot;2021-10-13T18:39:51Z&quot;
    message: ReplicaSet &quot;test-66&quot; has timed out progressing.
    reason: ProgressDeadlineExceeded
    status: &quot;False&quot;
    type: Progressing
  observedGeneration: 4
  replicas: 2
  unavailableReplicas: 2
  updatedReplicas: 1
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: &quot;2021-10-13T18:01:49Z&quot;
  labels:
    app: test-app
  name: test-service
  namespace: default
  resourceVersion: &quot;*****&quot;
  uid: *****************
spec:
  clusterIP: 10.161.100.100
  clusterIPs:
  - 10.161.100.100
  externalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - nodePort: 41945
    port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app: test-app
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - hostname: localhost
</code></pre>

Mohammad Saad
<p>The reason you are facing <strong>ImagePullBackOff</strong> and <strong>InvalidImageName</strong> issue is because your app image does not exist on the kubernetes cluster you deployed via docker, rather it exists on your local machine!</p>
<p>To resolve this issue for testing purpose what you can do is to mount the project workspace and create your image there on your kubernetes cluster and then build image using docker on the k8s cluster or upload your image to docker hub and then setting your deployment to pick image from docker hub!</p>
