kubernetes: `kubectl logs` with the `--follow` args, the log loops indefinitely

What happened:

Under ARM64 environment, POD log parameter is the wireless cycle of log after Follow

What you expected to happen:

Record of normal output log updates

How to reproduce it (as minimally and precisely as possible):

It’s always been that way

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
  • v1.19.0
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
  • Kylin Linux Advanced Server V10 (Tercel)
  • Kernel (e.g. uname -a):
  • 4.19.90-23.6.v2101.ky10.aarch64
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (19 by maintainers)

Most upvoted comments

Hi, this issue may be caused by a Kylinos kernel bug.

package main

import (
	"fmt"

	"github.com/fsnotify/fsnotify"
)

func main() {
	w, err := fsnotify.NewWatcher()

	if err != nil {
		panic(err)
	}

	w.Add("/var/log/pods/kube-system_coredns-f9fd979d6-7gj45_38c8e816-30aa-4a49-8c11-64b9c8a9915a/coredns/7.log")

	for {
		select {
		case e := <-w.Events:
			switch e.Op {
			case fsnotify.Write:
				fmt.Println("write")
			case fsnotify.Create:
				fmt.Println("create")
			case fsnotify.Rename:
				fmt.Println("rename")
			case fsnotify.Remove:
				fmt.Println("remove")
			case fsnotify.Chmod:
				fmt.Println("chmod")
			default:
				fmt.Println("Unexpected fsnotify event: %v, retrying...", e)
			}
		case err := <-w.Errors:
			fmt.Println("error:", err)
		}
	}
}

Run this code, can get the following output

./main
chmod
chmod
chmod
chmod
chmod
chmod
chmod
chmod
chmod
.......

These events will cause log loops. You can try changing to another linux kernel,for example 5.10.0-182.0.0.95.oe2203sp3.aarch64