When i issue
kubectl logs MY_POD_NAME –limit-bytes=1
command, the –limit-bytes option is ignored and i get all the pod’s logs.
My kubernetes version is 1.15.3
Trying to understand why that would be. When i issue the same command in GKE setup, the –limit-bytes option works as expected. I wonder what might be different in my setup to prevent this option from working correctly. (This is on CentOS).
Update: i tracked down the issue to Docker’s –log-driver option.
If the Docker –log-driver is set to ‘json-file’, then kubectl logs command works fine with –limit-bytes option. However, if the Docker -log-driver is set to ‘journald’, then kubectl logs command ignores the –limit-bytes option. Seems like a kubectl bug to me.
2
Answers
After executing this command you shoud have seen following error:
Execute:
If you set –limit-bytes flag you must know that
–limit-bytes=0: Maximum bytes of logs to return.
Defaults to no limit.=0: Maximum bytes of logs to return. Defaults to no limit.
Documentation of kubectl-logs.
Please let me know if it helps.
Yeah, it should work fine –
Please try this, if you have one container in application –
If you have multiple containers then please mention like –