Skip to content

aravindhp/kubectl-node-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Node Log viewer

kubectl-node-logs is a kubectl plugin for viewing and filtering node logs based on the oc adm node-logs implementation.

Prerequisites

  • Kubernetes cluster 1.27+
  • kubectl version 1.27+
  • Go version 1.21

Installation

From source

$ git clone https://github.com/aravindhp/kubectl-node-logs.git
$ cd kubectl-node-logs
$ go build -o kubectl-node_logs cmd/kubectl_node_logs.go
$ mv kubectl-node_logs /$USER/.local/bin # or any other directory in $PATH

Usage

Here is an example to retrieve the kubelet service logs from a node:

# Fetch kubelet logs from a node named node-1.example
$ kubectl node-logs node-1.example --query=kubelet

You can also fetch files, provided that the files are in a directory that the kubelet allows for log fetches. For example, you can fetch a log from /var/log/ on a node:

 kubectl node-logs node-1.example --query /foo.log

For further options, please see kubectl node-logs --help

Further reading