Hello Readers!! In this blog, we are going to see a new tool i.e Kail. We will see how we can use kail to view logs in Kubernetes. Frequently we use the kubectl command for looking at the logs of pods in Kubernetes. But it is not resilient to use when we want to see the logs from multiple pods. So, here is a very simple tool for you that we can use to view logs from multiple pods in Kubernetes at the same time and in a single window.How to use kail to view logs in Kubernetes
So, let’s get started!
Following is the GitHub repository for kail we can download it from here.
Run these commands for installing kail on your local:
$ wget https://github.com/boz/kail/releases/download/v0.15.0/kail_0.15.0_linux_amd64.tar.gz
$ tar zxf kail_0.15.0_linux_amd64.tar.gz
$ sudo mv kail /usr/local/bin
My kail is all set and ready to play.
How to use Kail:
Let’s start playing with it. I will type only a single word in my terminal and it will show me the logs of all the pods that are running in my cluster.
You can see below its showing the logs of all running pods:
We can see all the kail commands that we will use further:
$ kail –help
If we want to see the log of any particular pod inside my container we can do this by running the following command:
$ kail -p <pod_name>
When we want to see the logs of all the pods that are running in a particular namespace then we have to use:
$ kail -n <namespace>
What if we want to see the logs of the last 10 minutes? Kail also provides this option let’s see:
$ kail -p <pod_name> –since <time>
$ kail -n <namespace> –since <time>
If you want to see the logs of the container that has a particular label then use this command:
$ kail -l <label> --since <time>
If you want to see the logs of all the pods running inside a node then run the following command:
$ kail –node <node_name>
If you want to see the logs of any particular deployment you can use this command:
$ kail --deploy <deployment_name> --since <time>
$ kail –svc <service_name>
Similarly for containers, you can see it by:
$ kail –containers <container_name>
So, if you want to use more commands, then you can easily do it. It is really so simple to use. It’s a very easy way to visualize all your kubernetes objects.
Thank you for sticking to the end. In this blog, we have seen how to use kail to view logs in Kubernetes. If you like this blog, please show your appreciation by giving thumbs-ups and share this blog and give me suggestions on how I can improve my future posts to suit your needs.