title: GKE deployment ReactJS app CrashLoopBackoff
body: <p>I have built my Docker image for my ReactJS app. I run the image locally and tested it, which works fine.</p>
  <p>I'm using Google Cloud Build which automatically puts my container image to gcr.io container repo.</p>
  <p>Then I try to create a deployment from my container image which resides in gcr.io</p>
  <p>But the deployment is not successfully finishing. It gives me</p>
  <blockquote>
  <p>Pod errors: CrashLoopBackOff</p>
  <p>Does not have minimum availability</p>
  </blockquote>
  <p>Here is my Docker image.</p>
  <pre><code>FROM node:latest
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  COPY package.json .
  RUN npm install
  COPY . ./
  EXPOSE 3000
  CMD [ &quot;npm&quot;, &quot;start&quot; ]
  </code></pre>
  <p>When I look at the pod -&gt; container logs, I see my app has been restarting without any error log.</p>
  <pre><code>I 2020-04-27T15:07:57.505370601Z &gt; react-scripts start
   
  I 2020-04-27T15:07:57.505375001Z 
   
  I 2020-04-27T15:07:59.392880949Z [34mℹ[39m [90m｢wds｣[39m: Project is running at http://10.48.0.14/
   
  I 2020-04-27T15:07:59.393329591Z [34mℹ[39m [90m｢wds｣[39m: webpack output is served from 
   
  I 2020-04-27T15:07:59.393494921Z [34mℹ[39m [90m｢wds｣[39m: Content not from webpack is served from /usr/src/app/public
   
  I 2020-04-27T15:07:59.393641770Z [34mℹ[39m [90m｢wds｣[39m: 404s will fallback to /
   
  I 2020-04-27T15:07:59.393881277Z Starting the development server...
  </code></pre>
  <p>I suspect what happens is, kubernetes does not wait enough and try to restart application.</p>
  <p>I'm not using a deployment.yaml but simply using the GCP console.
  There is no health endpoint in my ReactJS app.</p>
  <p>This is the output for <code>kubectl describe pod ...</code></p>
  <pre><code>Name:           helloworld-gke-7fd977fd94-kvrcj
  Namespace:      default
  Priority:       0
  Node:           gke-helloworld-gke-default-pool-a23be758-g8q7/10.182.0.2
  Start Time:     Mon, 27 Apr 2020 17:15:18 +0200
  Labels:         app=hello
                  pod-template-hash=7fd977fd94
  Annotations:    kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container hello-app
  Status:         Running
  IP:             10.48.0.15
  IPs:            &lt;none&gt;
  Controlled By:  ReplicaSet/helloworld-gke-7fd977fd94
  Containers:
    hello-app:
      Container ID:   docker://389151ed6...
      Image:          gcr.io/tuition-h...
      Image ID:       docker-pullable://gcr.io/...
      Port:           3000/TCP
      Host Port:      0/TCP
      State:          Waiting
        Reason:       CrashLoopBackOff
      Last State:     Terminated
        Reason:       Completed
        Exit Code:    0
        Started:      Mon, 27 Apr 2020 18:28:00 +0200
        Finished:     Mon, 27 Apr 2020 18:28:02 +0200
      Ready:          False
      Restart Count:  19
      Requests:
        cpu:  100m
      Environment:
        PORT:  8080
      Mounts:
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-sqpm7 (ro)
  Conditions:
    Type              Status
    Initialized       True
    Ready             False
    ContainersReady   False
    PodScheduled      True
  Volumes:
    default-token-sqpm7:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-sqpm7
      Optional:    false
  QoS Class:       Burstable
  Node-Selectors:  &lt;none&gt;
  Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                   node.kubernetes.io/unreachable:NoExecute for 300s
  Events:
    Type     Reason   Age                    From                                                    Message
    ----     ------   ----                   ----                                                    -------
    Warning  BackOff  4m17s (x320 over 74m)  kubelet, gke-helloworld-gke-default-pool-...  Back-off restarting failed container
  </code></pre>