Skip to content

nerdctl will not output logs after log file is rotated #3199

@xyz-li

Description

@xyz-li

Description

nerdctl -n k8s.log logs CONTAINER_ID -f won't output logs after kubelet rotate log filer of the container.
Related issue with k8s kubernetes/kubernetes#115701.

Steps to reproduce the issue

  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 nerdctl -n k8s.io logs containerd -f

Describe the results you received and expected

nerdctl output logs correctly after the log file is rotated.

What version of nerdctl are you using?

v2.0.0-rc.0

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions