1

when I using this command to check the linux service log:

root@k8sslave01:/usr/lib/systemd/system# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
     Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/kubelet.service.d
             └─10-kubeadm.conf
     Active: active (running) since Sat 2023-11-11 20:57:40 CST; 38min ago
       Docs: https://kubernetes.io/docs/
   Main PID: 22401 (kubelet)
      Tasks: 10 (limit: 2025)
     Memory: 48.5M
        CPU: 21.417s
     CGroup: /system.slice/kubelet.service
             └─22401 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime-endpoint=unix:///var/run/containerd/contai>

Nov 11 21:35:42 k8sslave01 kubelet[22401]: E1111 21:35:42.042501 22401 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get sandbox image "registry.k8s.io/pause:3.6": failed to > Nov 11 21:35:42 k8sslave01 kubelet[22401]: E1111 21:35:42.042521 22401 kuberuntime_manager.go:1166] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get sandbox image "registry.k8s.io/pause:3.6": failed to> Nov 11 21:35:42 k8sslave01 kubelet[22401]: E1111 21:35:42.042593 22401 pod_workers.go:1300] "Error syncing pod, skipping" err="failed to "CreatePodSandbox" for "calico-node-lsxn7_calico-system(a53e96ad-d80b-4589-8ce5-7b76f4f3dc0d)" with> Nov 11 21:35:44 k8sslave01 kubelet[22401]: E1111 21:35:44.006706 22401 pod_workers.go:1300] "Error syncing pod, skipping" err="network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady messag>

I just see part of the log output, is it possible to auto wrap the log output in linux termimal? this is the UI output:

enter image description here

the black arrow content could not show in the terminal. how to auto wrap the output content?

Dolphin
  • 609

1 Answers1

1

If you don't mind losing the colors, you can just pipe to cat which should result in your terminal wrapping the output. Compare:

  • systemctl status thermald.service

    screenshot of unwrapped systemctl status thermald.service output

  • systemctl status thermald.service | cat

    screenshot of wrapped systemctl status thermald.service | cat output

Even simpler, use -l and --no-pager:

output of systemctl status --no-pager -l thermald.service

terdon
  • 242,166