<p><code>kubectl logs -f pod</code> shows all logs from the beginning and it becomes a problem when the log is huge and we have to wait for a few minutes to get the last log. Its become more worst when connecting remotely. Is there a way that we can tail the logs for the last 100 lines of logs and follow them?</p>

<p>In a cluster best practices are to gather all logs in a single point through an aggregator and analyze them with a dedicated tool. For that reason in K8S, log command is quite basic.</p>
<p>Anyway <code>kubectl logs -h</code> shows some options useful for you:</p>
<pre><code># Display only the most recent 20 lines of output in pod nginx
kubectl logs --tail=20 nginx

# Show all logs from pod nginx written in the last hour
kubectl logs --since=1h nginx
</code></pre>
<p>Some tools with your requirements (and more) are available on github, some of which are:</p>
<ul>
<li><p><a href="https://github.com/boz/kail" rel="noreferrer">https://github.com/boz/kail</a></p>
</li>
<li><p><a href="https://github.com/stern/stern" rel="noreferrer">https://github.com/stern/stern</a></p>
</li>
</ul>
