What happened:
Executed command:
kubectl logs -n kube-system -l k8s-app=kube-dns
Only received a subset of the logs from the pods with the label.
Manually collecting the logs pod-by-pod shows many more results. It's as if using the label selector causes the results to be truncated.
Seems to only return 20 lines max.
What you expected to happen:
Expected to see all results for all log entries of all pods.
How to reproduce it (as minimally and precisely as possible):
kubectl logs -n kube-system -l k8s-app=kube-dnskubectl logs -n kube-system <dnsPodName>Anything else we need to know?:
N/A
Environment:
kubectl version):kubectl version --short
Client Version: v1.18.2
Server Version: v1.17.7
cat /etc/os-release): NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
/assign
See help info in kubectl logs --help:
cmd.Flags().Int64Var(&o.Tail, "tail", o.Tail, "Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is provided.")
Thank you @zhouya0 , makes sense - as expected this behaves properly for me with:
kubectl logs -n kube-system -l k8s-app=kube-dns --tail -1
Thanks for your help and the clarification!
Most helpful comment
Thank you @zhouya0 , makes sense - as expected this behaves properly for me with:
kubectl logs -n kube-system -l k8s-app=kube-dns --tail -1Thanks for your help and the clarification!