<p>I found out that my database that was hosted on Kubernetes constantly getting removed all the data in a collection after some time. I want to make sure it isn't some sort of deployment or config error so I would like to check the logs of MongoDB itself.</p>
<p>I tried <code>kubectl logs &lt;mongodb-pod-name&gt;</code> but it only logs the connection and disconnection to the mongodb pod. Would like to access to <code>mongodb.log</code> file to check if the data is removed automatically or someone had executed a command to remove it.</p>
<p>The mongo db is hosted on Amazon EKS.</p>
<p>Is it possible or there is any other way that I can investigate this issue?
Appreciate the help!</p>

Sivvie Lim
<p>You can:</p>
<p><code>kubectl describe pod &lt;mongodb-pod-name&gt;</code></p>
<p>Then, you can access the container :</p>
<pre><code>kubectl exec --stdin --tty &lt;mongodb-pod-name&gt;  -- /bin/bash
</code></pre>
<p>or:</p>
<pre><code>  kubectl exec --stdin --tty &lt;mongodb-pod-name&gt;  -- sh
</code></pre>
<p>And see logs inside the container</p>
