Kubernetes tail. Streams logs from all containers of all matched pods. Match pods by service, replicaset, deployment, and others. Adjusts to a changing cluster - pods are added and removed from logging as they fall in or out of the selection.
With no arguments, kail matches all pods in the cluster. You can control the matching pods with arguments which select pods based on various criteria.
||match pods based on a standard label selector|
||match pods by name|
||match pods in the given namespace|
||match pods belonging to the given service|
||match pods belonging to the given replication controller|
||match pods belonging to the given replica set|
||match pods belonging to the given deployment|
||match pods running on the given node|
||match pods belonging to services targeted by the given ingress|
||restrict which containers logs are shown for|
||Ignore pods that the selector matches. (default:
When selecting objects by
--pod, etc...), you can either qualify it with a namespace to restrict the selection to the given namespace, or select across all namespaces by giving just the object name.
# match pods belonging to a replicaset named 'workers' in any namespace. $ kail --rs workers # match pods belonging to the replicaset named 'workers' only in the 'staging' namespace $ kail --rs staging/workers
If the same flag is used more than once, the selectors for that flag are "OR"ed together.
# match pods belonging to a replicaset named "workers" or "db" $ kail --rs workers --rs db
Different flags are "AND"ed together:
# match pods belonging to both the service "frontend" and the deployment "webapp" $ kail --svc frontend --deploy webapp
||Display help and usage|
||Use the given Kubernetes context|
||Print initial matched pods and exit|
||Set the logging level (default:
||Write output to
||Display logs as old as given duration. Ex:
|See here for more information on the duration format.|
$ brew tap boz/repo $ brew install boz/repo/kail
Kail binaries for Linux and OSX can be found on the latest release page. Download and install into your
$ bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$GOPATH/bin"
Running in a cluster with
The docker image abozanich/kail is available for running
kail from within a kubernetes pod via
Note: be sure to include the
kail.ignore=true label, otherwise... it's logging all the way down.
# match all pods - synonymous with 'kail' from the command line $ kubectl run -it --rm -l kail.ignore=true --restart=Never --image=abozanich/kail kail # match pods belonging to service 'api' in any namespace - synonymous with 'kail --svc api' $ kubectl run -it --rm -l kail.ignore=true --restart=Never --image=abozanich/kail kail -- --svc api
Install build and dev dependencies
Install source code and golang dependencies
$ go get -d github.com/boz/kail $ cd $GOPATH/src/github.com/boz/kail $ make install-deps
Install run against a demo cluster
$ minikube start $ ./_example/demo.sh start $ ./kail # install image into minikube and run via kubectl $ make image-minikube $ kubectl run -it --rm -l kail.ignore=true --restart=Never --image=kail kail
Start minikube with a fair amount of CPU and memory.
$ minikube start --cpus 4 --memory 8192
$ kubectl create -f _example/stress.yml
Wait a while for the pods to run
$ kubectl get pods --namespace stress | grep Running | wc -l 100
./kail --ns stress