<p>I am new to kubernetes. I am running my kubernetes cluster inside my Docker Desktop VM. Below are the versions</p>
<p>Docker Desktop Community : 2.3.0.4 (Stable)<br>
Engine: 19.03.12<br>
kubernetes: 1.16.5</p>
<p>i created a simple react app. below is the Docker file.</p>
<pre><code>FROM node:13.12.0-alpine    

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH


COPY package*.json ./    
RUN npm install  

# add app files
COPY . ./     

# start app
CMD [&quot;npm&quot;, &quot;start&quot;]
</code></pre>
<p>I built a docker image and ran it. it works fine. I added the image in the below deployment.yaml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: test-react-app
  namespace: dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-react-app
  template:
    metadata:
      labels:
        app: test-react-app
    spec:
      containers:
        - name: test-react
          image: myrepo/test-react:v2
          imagePullPolicy: Never
          ports:
            - containerPort: 80


---
kind: Service
apiVersion: v1
metadata:
  name: test-service
  namespace: dev
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
      nodePort: 31000
  selector:
    app: test-react-app
</code></pre>
<p>The pod never starts. Below is the events from describe.</p>
<pre><code>Type     Reason     Age                  From                     Message
  ----     ------     ----                 ----                     -------
  Normal   Scheduled  &lt;unknown&gt;            default-scheduler        Successfully assigned dev/test-deployment-7766949554-m2fbz to docker-desktop
  Normal   Pulled     8m38s (x5 over 10m)  kubelet, docker-desktop  Container image &quot;myrepo/test-react:v2&quot; already present on machine
  Normal   Created    8m38s (x5 over 10m)  kubelet, docker-desktop  Created container test-react
  Normal   Started    8m38s (x5 over 10m)  kubelet, docker-desktop  Started container test-react
  Warning  BackOff    26s (x44 over 10m)   kubelet, docker-desktop  Back-off restarting failed container
</code></pre>
<p>Below is the logs from the container. It looks as if the container is running..</p>
<pre><code>&gt; react-cart@0.1.0 start /app
&gt; react-scripts start

[34mℹ[39m [90m｢wds｣[39m: Project is running at http://10.1.0.33/
[34mℹ[39m [90m｢wds｣[39m: webpack output is served from
[34mℹ[39m [90m｢wds｣[39m: Content not from webpack is served from /app/public
[34mℹ[39m [90m｢wds｣[39m: 404s will fallback to /
Starting the development server...
</code></pre>

Seeker
<p>It worked!!!</p>
<p>I build the react app into a production app and then copied the docker file. I followed the technique given in this link <a href="https://dev.to/rieckpil/deploy-a-react-application-to-kubernetes-in-5-easy-steps-516j" rel="nofollow noreferrer">https://dev.to/rieckpil/deploy-a-react-application-to-kubernetes-in-5-easy-steps-516j</a>.</p>
