How it works...

As you can see, the installed Kibana versions are different based on the Kubernetes provisioning tool. But this cookbook explores the basic functions of Kibana. Therefore, there are no version-specific operations to worry about.

Let's launch a sample application and then learn how to monitor your application log using Kibana:

  1. Prepare a sample application that keeps printing a DateTime and hello message to the stdout:
$ cat myapp.yaml
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
containers:
- image: busybox
name: application
args:
- /bin/sh
- -c
- >
while true; do
echo "$(date) INFO hello";
sleep 1;
done
  1. Create a sample application in the chap9 namespace:
$ kubectl create -f myapp.yaml --namespace=chap9
pod "myapp" created
  1. Access the Kibana WebUI, then click the Discover tab:
  1. Make sure the time range is Last 15 minutes, then type kubernetes.namespace_name: chap9 in the search box and hit the Enter key:
Searching the chap9 namespace log in 15 minutes
  1. You can see all of the logs in the chap9 namespaces as follows. The screenshot shows much more information than you might have expected. By clicking the add button for kubernetes.host, kubernetes.pod_name, and log will display only the fields necessary for this purpose:
Choosing log columns
  1. Now you can see a more simple log view for this application:
Showing the final state of a customized Kibana view

Congratulations! You now have have a centralized log management system in your Kubernetes cluster. You can observe the deployment of some Pods to see how you can see the application log.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.30.210