<p>How to debug why it's status is CrashLoopBackOff?</p>

<p>I am not using minikube , working on Aws Kubernetes instance.</p>

<p>I followed this tutorial.
<a href="https://github.com/mkjelland/spring-boot-postgres-on-k8s-sample" rel="nofollow noreferrer">https://github.com/mkjelland/spring-boot-postgres-on-k8s-sample</a></p>

<p>When I do </p>

<pre><code>  kubectl create -f specs/spring-boot-app.yml
</code></pre>

<p>and check status by </p>

<pre><code>  kubectl get pods 
</code></pre>

<p>it gives </p>

<pre><code>     spring-boot-postgres-sample-67f9cbc8c-qnkzg   0/1     CrashLoopBackOff   14         50m
</code></pre>

<p>Below Command </p>

<pre><code> kubectl describe pods spring-boot-postgres-sample-67f9cbc8c-qnkzg
</code></pre>

<p>gives </p>

<pre><code>Events:
  Type     Reason   Age                    From                      Message
  ----     ------   ----                   ----                      -------
  Warning  BackOff  3m18s (x350 over 78m)  kubelet, ip-172-31-11-87  Back-off restarting failed container
</code></pre>

<p>Command <strong>kubectl get pods --all-namespaces</strong> gives </p>

<pre><code>NAMESPACE     NAME                                           READY   STATUS             RESTARTS   AGE
default       constraintpod                                  1/1     Running            1          88d
default       postgres-78f78bfbfc-72bgf                      1/1     Running            0          109m
default       rcsise-krbxg                                   1/1     Running            1          87d
default       spring-boot-postgres-sample-667f87cf4c-858rx   0/1     CrashLoopBackOff   4          110s
default       twocontainers                                  2/2     Running            479        89d
kube-system   coredns-86c58d9df4-kr4zj                       1/1     Running            1          89d
kube-system   coredns-86c58d9df4-qqq2p                       1/1     Running            1          89d
kube-system   etcd-ip-172-31-6-149                           1/1     Running            8          89d
kube-system   kube-apiserver-ip-172-31-6-149                 1/1     Running            1          89d
kube-system   kube-controller-manager-ip-172-31-6-149        1/1     Running            1          89d
kube-system   kube-flannel-ds-amd64-4h4x7                    1/1     Running            1          89d
kube-system   kube-flannel-ds-amd64-fcvf2                    1/1     Running            1          89d
kube-system   kube-proxy-5sgjb                               1/1     Running            1          89d
kube-system   kube-proxy-hd7tr                               1/1     Running            1          89d
kube-system   kube-scheduler-ip-172-31-6-149                 1/1     Running            1          89d
</code></pre>

<p>Command <strong>kubectl logs spring-boot-postgres-sample-667f87cf4c-858rx</strong>
doesn't print anything.</p>

Dhanraj
<p>Why don't you...</p>

<ol>
<li><p>run a dummy container (run an endless sleep command)</p></li>
<li><p>kubectl exec -it  bash</p></li>
<li><p>Run the program directly and have a look at the logs directly. </p></li>
</ol>

<p>Its an easier form of debugging on K8s.</p>
