<p>As part of the CICD pipeline I deploy my web api to kubernetes, the most recent branch I'm working on keeps crashing.</p>

<p>I have made sure the app runs locally for all the configurations, also the CICD pipeline on the master branch succeeds. I'm assuming is some change I introduced is making the app fail but I can't see any problem on the logs.</p>

<p>This is my DOCKERFILE</p>

<pre><code>FROM node:12

WORKDIR /usr/src/app

ARG NODE_ENV
ENV NODE_ENV $NODE_ENV

COPY package.json /usr/src/app/
RUN npm install

COPY . /usr/src/app

ENV PORT 5000
EXPOSE $PORT
CMD [ "npm", "start" ]

</code></pre>

<p>this is what I get when I run kubectl describe on the corresponding pod</p>

<pre><code>Controlled By:      ReplicaSet/review-refactor-e-0jmik1-7f75c45779
Containers:
  auto-deploy-app:
    Container ID:   docker://8d6035b8ee0938262ea50e2f74d3ab627761fdf5b1811460b24f94a74f880810
    Image:          registry.gitlab.com/hidden-fox/metadata-service/refactor-endpoints:5e986c65d41743d9d6e6ede441a1cae316b3e751
    Image ID:       docker-pullable://registry.gitlab.com/hidden-fox/metadata-service/refactor-endpoints@sha256:de1e4478867f54a76f1c82374dcebb1d40b3eb0cde24caf936a21a4d16471312
    Port:           5000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sat, 27 Jul 2019 19:18:07 +0100
      Finished:     Sat, 27 Jul 2019 19:18:49 +0100
    Ready:          False
    Restart Count:  7
    Liveness:       http-get http://:5000/ delay=15s timeout=15s period=10s #success=1 #failure=3
    Readiness:      http-get http://:5000/ delay=5s timeout=3s period=10s #success=1 #failure=3
    Environment Variables from:
      review-refactor-e-0jmik1-secret  Secret  Optional: false
    Environment:
      DATABASE_URL:  postgres://:@review-refactor-e-0jmik1-postgres:5432/
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-mvvfv (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-mvvfv:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-mvvfv
    Optional:    false
QoS Class:       BestEffort
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
  ----     ------     ----                   ----                                         -------
  Normal   Scheduled  9m52s                  default-scheduler                            Successfully assigned metadata-service-13359548/review-refactor-e-0jmik1-7f75c45779-jfw22 to gke-qa2-default-pool-4dc045be-g8d9
  Normal   Pulling    9m51s                  kubelet, gke-qa2-default-pool-4dc045be-g8d9  pulling image "registry.gitlab.com/hidden-fox/metadata-service/refactor-endpoints:5e986c65d41743d9d6e6ede441a1cae316b3e751"
  Normal   Pulled     9m45s                  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Successfully pulled image "registry.gitlab.com/hidden-fox/metadata-service/refactor-endpoints:5e986c65d41743d9d6e6ede441a1cae316b3e751"
  Warning  Unhealthy  8m58s                  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Readiness probe failed: Get http://10.48.1.34:5000/: dial tcp 10.48.1.34:5000: connect: connection refused
  Warning  Unhealthy  8m28s (x6 over 9m28s)  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Readiness probe failed: HTTP probe failed with statuscode: 404
  Normal   Started    8m23s (x3 over 9m42s)  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Started container
  Warning  Unhealthy  8m23s (x6 over 9m23s)  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Liveness probe failed: HTTP probe failed with statuscode: 404
  Normal   Killing    8m23s (x2 over 9m3s)   kubelet, gke-qa2-default-pool-4dc045be-g8d9  Killing container with id docker://auto-deploy-app:Container failed liveness probe.. Container will be killed and recreated.
  Normal   Pulled     8m23s (x2 over 9m3s)   kubelet, gke-qa2-default-pool-4dc045be-g8d9  Container image "registry.gitlab.com/hidden-fox/metadata-service/refactor-endpoints:5e986c65d41743d9d6e6ede441a1cae316b3e751" already present on machine
  Normal   Created    8m23s (x3 over 9m43s)  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Created container
  Warning  BackOff    4m42s (x7 over 5m43s)  kubelet, gke-qa2-default-pool-4dc045be-g8d9  Back-off restarting failed container
</code></pre>

<p>I expect the app to get deployed to kubernetes but instead I see a CrashLoopBackOff error on kubernetes.</p>

<p>I also don't see any application specific errors in the logs.</p>

sergio.nava
<p>I figured it out. I had to add an endpoint mapped to the root url, apparently as part of the CD it gets ping and if there is no response then the job fails.</p>
