Issues with setting up kubernetes for local testing using docker image

  docker, kubernetes

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.

$ 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

I am using Docker-desktop on windows to run run kubernetes. This exposes my cluster to external IP localhost but i cannot access my app. I checked the status of the pods and noticed this issue:

$ kubectl get pods
 NAME         READY   STATUS             RESTARTS   AGE
test-66-ps2   0/1     ImagePullBackOff   0          8h
test-6f-6jh   0/1     InvalidImageName   0          7h42m

May I know what could be causing this issue? And how can i make it work on local ?
Thanks, Look forward to the suggestions!

My YAML file for reference:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "4"
  creationTimestamp: "2021-10-13T18:00:15Z"
  generation: 4
  labels:
    app: test-app
  name: test-app
  namespace: default
  resourceVersion: "*****"
  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:Userstest-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: "2021-10-13T18:00:15Z"
    lastUpdateTime: "2021-10-13T18:00:15Z"
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: "2021-10-13T18:39:51Z"
    lastUpdateTime: "2021-10-13T18:39:51Z"
    message: ReplicaSet "test-66" has timed out progressing.
    reason: ProgressDeadlineExceeded
    status: "False"
    type: Progressing
  observedGeneration: 4
  replicas: 2
  unavailableReplicas: 2
  updatedReplicas: 1
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2021-10-13T18:01:49Z"
  labels:
    app: test-app
  name: test-service
  namespace: default
  resourceVersion: "*****"
  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

Source: Docker Questions

LEAVE A COMMENT