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 will not output logs after the log file is rotated. #115701

Closed
xyz-li opened this issue Feb 11, 2023 · 6 comments · Fixed by #115702
Closed

kubectl logs will not output logs after the log file is rotated. #115701

xyz-li opened this issue Feb 11, 2023 · 6 comments · Fixed by #115702
Assignees
Labels
area/kubelet kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/node Categorizes an issue or PR as relevant to SIG Node. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@xyz-li
Copy link
Contributor

xyz-li commented Feb 11, 2023

What happened?

kubectl logs POD_NAME -f won't output logs after kubelet rotate log filer of the container.

What did you expect to happen?

kubectl output logs correctly after the log file is rotated.

How can we reproduce it (as minimally and precisely as possible)?

  1. Add the config containerLogMaxSize: 5Mi to kubelet.yaml. So kubelet will rotate the log soon.
  2. Build a image with this program
package main

import (
     "fmt"
     "time"
)

func main() {
     i := 0
     for range time.Tick(10 * time.Microsecond) {
             fmt.Printf("print log to stand out %d\n", i)
             i++
     }
}
  1. Create a deploy with the previous image.
  2. Run the command kubectl logs POD_NAME -f

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-26T10:58:54Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:51:45Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

None

OS version

# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
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"
UBUNTU_CODENAME=jammy
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
Linux andrewli 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

@xyz-li xyz-li added the kind/bug Categorizes issue or PR as related to a bug. label Feb 11, 2023
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 11, 2023
@xyz-li
Copy link
Contributor Author

xyz-li commented Feb 11, 2023

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 11, 2023
@xyz-li
Copy link
Contributor Author

xyz-li commented Feb 11, 2023

/area kubelet

@SergeyKanzhelev
Copy link
Member

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 17, 2023
@SergeyKanzhelev SergeyKanzhelev moved this from Triage to Triaged in SIG Node Bugs Feb 17, 2023
@SergeyKanzhelev
Copy link
Member

/assign @xyz-li
since you sent a PR already

@rayjanoka
Copy link

Ran into this issue! 😃

@wu0407
Copy link

wu0407 commented Sep 11, 2023

containerd log stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubelet kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/node Categorizes an issue or PR as relevant to SIG Node. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging a pull request may close this issue.

5 participants