<p>I will try to explain my problem below, </p>

<ol>
<li><p>Create a pod using deployment and then apply one more update on it using <code>kubectl apply -f sampledep.yaml</code>.</p></li>
<li><p>Pod name would have changed if we do <code>kubectl get pods</code>.</p></li>
<li><p>So whatever logs we had in our previous pod no longer exist or can be retrieved.</p></li>
</ol>

<p>I will list down the questions below now:</p>

<ol>
<li>Is there a way to retrieve old pod logs for that application?</li>
<li>Is there a way to configure size of logs that can be accumulated for a pod?</li>
<li>What happens to pod if log gets accumulated too much and there is no space left in it!</li>
<li>What is recommended way to view/manage logs in kubernetes for pods deployed?</li>
</ol>

<ol>
<li><p>Try to run <code>kubectl get pods --show-all</code>. If you can find your pod there you can just use <code>kubectl logs &lt;pod name&gt;</code>. If not, I don't think you can retrieve the logs anymore.</p></li>
<li><p>The recommended way to manage logs in k8s is using an addon like <a href="https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch" rel="nofollow noreferrer">fluentd-elasticsearch</a>. This way, you never save logs on the pod FS itself, you just print logs from your container to STDOUT and fluentd will automatically ship the logs to Elasticsearch, which you can later on interrogate with Kibana. There's no need to limit accumulated logs for a pod since it is never accumulated on the pods itself.</p></li>
</ol>
