-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k8s logtail #3758
k8s logtail #3758
Conversation
…o k8s_container_logs
f-string refactor fix label selector
5370331
to
b0846a1
Compare
@romilbhardwaj I finished running the smoke tests on my end if you have a spare cycle to take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @asaiacai!
@romilbhardwaj reran the smoke tests and manually checked |
Thanks @asaiacai. Pushed some changes to reduce sleep (which was causing delays in pod termination). lmk what you think. BTW, tests seem to be failing for me:
Logs: https://gist.github.com/romilbhardwaj/4065c409f089760fb11415f0bf186262 Looks like logs are correctly tailed on the first This was on a GKE cluster. Interestingly, the manual repro seems to work on my local |
hey @romilbhardwaj thanks for the edits! seems like there was variable delay between the task stdout/stderr being written to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @asaiacai! Tested it, works nicely. LGTM.
Closes #3429
This swaps the container sleep with a logtailing process so that pod logs now show task logs. These are retrievable via
kubectl logs <POD_NAME>
and also written to/var/log/pods/*/*/*.log
on the node disk, so it should integrate with most k8s logging solutions out of the box (OpenTelemetry, Fluentd, Filebeats, etc.)Implemented as a watcher process that does
tail -f
if there's an open writing file handle on the task log by checkinglsof
and closes thetail -f
program if there are no such writers.Tested (run the relevant ones):
bash format.sh
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_container_logs_multinode_kubernetes
pytest tests/test_smoke.py::test_container_logs_two_jobs_kubernetes
pytest tests/test_smoke.py::test_container_logs_two_simultaneous_jobs_kubernetes