aravindhp / kubectl-node-logs

Kubectl plugin for viewing node logs
https://kubernetes.io/docs/concepts/cluster-administration/system-logs/#log-query
Apache License 2.0
4 stars 0 forks source link

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

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