Search code examples
bashkubectlxargs

View kubectl logs page by page on bash terminal


Team, On bash I run below to view logs but when they are huge the terminal all is all occupied dumping them out and i can't stop it for minutes.

Is there a way i can execute kubectl on bash in a a way that it shows logs only till shell screen size and then i use return key or spacebar to see more ? just like journalctl? but i want to achieve this when using kubectl.

kubectl logs test-pod -n namespace-test

Above displans 10K lines at a time which i don't want. Neither I want to exec on to the pod and see log file physically. any hints? or is there something like which displays last 100lines? or first with xargs?


Solution

  • You can do:

    kubectl logs --tail=100 test-pod -n namespace-test