<p>I deploy a elasticsearch to minikube with below configure file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
spec:
  replicas: 1
  selector:
    matchLabels:
      name: elasticsearch
  template:
    metadata:
      labels:
        name: elasticsearch
    spec:
      containers:
        - name: elasticsearch
          image: elasticsearch:7.10.1
          ports:
            - containerPort: 9200
            - containerPort: 9300
</code></pre>
<p>I run the command <code>kubectl apply -f es.yml</code> to deploy the <code>elasticsearch</code> cluster.</p>
<pre><code>$ kubectl get pod
NAME                            READY   STATUS    RESTARTS   AGE
elasticsearch-fb9b44948-bchh2   1/1     Running   5          6m23s
</code></pre>
<p>The elasticsearch pod keep restarting every a few minutes. When I run <code>kubectl describe pod </code> command, I can see these events:</p>
<pre><code>Events:
  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  7m11s                  default-scheduler  Successfully assigned default/elasticsearch-fb9b44948-bchh2 to minikube
  Normal   Pulled     3m18s (x5 over 7m11s)  kubelet            Container image &quot;elasticsearch:7.10.1&quot; already present on machine
  Normal   Created    3m18s (x5 over 7m11s)  kubelet            Created container elasticsearch
  Normal   Started    3m18s (x5 over 7m10s)  kubelet            Started container elasticsearch
  Warning  BackOff    103s (x11 over 5m56s)  kubelet            Back-off restarting failed container
</code></pre>
<p>The last event is <code>Back-off restarting failed</code> but I don't know why it restarts the pod. Is there any way I can check why it keeps restarting?</p>

<p>The first step (<code>kubectl describe pod</code>) you've already done. As a next step I suggest checking container logs: <code>kubectl logs &lt;pod_name&gt;</code>. 99% you get the reason from logs in this case (I bet on <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html" rel="noreferrer">bootstrap check</a> failure).</p>
<p>When neither <code>describe pod</code> nor logs do not have anything about the error, I get into the container with 'exec': <code>kubectl exec -it &lt;pod_name&gt; -c &lt;container_name&gt; sh</code>. With this you'll get a shell inside the container (of course if there IS a shell binary in it) ans so you can use it to investigate the problem manually. Note that to keep failing container alive you may need to change <code>command</code> and <code>args</code> to something like this:</p>
<pre class="lang-yaml prettyprint-override"><code>command:
  - /bin/sh
  - -c
args:
  - cat /dev/stdout
</code></pre>
<p>Be sure to disable probes when doing this. A container may restart if liveness probe fails, you will see that in <code>kubectl describe pod</code> if it happen. Since your snippet doesn't have any probes specified, you can skip this.</p>
