Skip to content
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

kubectl logs -f immediately returns instead of waits for container death #35

Open
antoinetran opened this issue Nov 4, 2024 · 5 comments

Comments

@antoinetran
Copy link
Contributor

Short Description of the issue

When doing kubectl logs [pod] -f, it returns the logs and dies immediately, even if the main container is still running. It should not return and continues to show logs until it dies.

Environment

  • Operating System:
  • Other related components versions:

Steps to reproduce

Logs, stacktrace, or other symptoms

output

Summary of proposed changes

@antoinetran
Copy link
Contributor Author

I don't know if there is a more elegant solution than doing a regular sleep of 2s and check if the container died, in follow mode. Or with inotify , we can avoid sleep.

@antoinetran
Copy link
Contributor Author

It took me a bit of time to understand how the logs are returned to virtual kubelet. I created an issue at virtual-kubelet because something needs to be done there first.

@dciangot
Copy link
Collaborator

dciangot commented Nov 8, 2024

@antoinetran as anticipated via chat, I think it’s matter of implementing a stream response in LogRetrieval function in execute.go file in interlink

can you cross check and see if that makes sense to you?

@antoinetran
Copy link
Contributor Author

@antoinetran as anticipated via chat, I think it’s matter of implementing a stream response in LogRetrieval function in execute.go file in interlink

can you cross check and see if that makes sense to you?

I am trying a few things, it will take some time, I am a bit slow in GO :)

@antoinetran
Copy link
Contributor Author

I tested a bit the GO http stream, and I think it is a good solution. The HTTP server can send the HTTP status code , and write the body continuously. The client can get the HTTP status, and read the HTTP body, it hangs until the server stops. Then the client gets EOF at the read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants