WEBVTT

00:00.660 --> 00:03.650
Hello and welcome to this lecture. In this lecture

00:03.660 --> 00:12.130
we will talk about various Logging mechanisms in kubernetes. Let us start with logging in Docker. I run

00:12.130 --> 00:19.450
a docker container called event-simulator and all that it does is generate random events simulating a web

00:19.450 --> 00:20.580
server.

00:20.620 --> 00:25.020
These are events streamed to the standard output by the application.

00:25.030 --> 00:31.540
Now, if I were to run the docker container in the background, in a detached mode using the –d option,

00:32.200 --> 00:35.950
I wouldn't see the logs if I wanted to view the logs.

00:36.070 --> 00:43.030
I could use the docker logs command followed by the container ID. The –f option helps us see the

00:43.030 --> 00:45.020
live log trail.

00:45.130 --> 00:51.860
Now back to Kubernetes. We create a pod with the same docker image using the pod definition file.

00:52.210 --> 00:58.920
Once it’s the pod is running, we can view the logs using the kubectl logs command with the pod name.

00:59.150 --> 01:05.310
Use the –f option to stream  the logs live just like the docker command.

01:05.380 --> 01:09.940
Now these logs are specific to the container running inside the pod.

01:10.000 --> 01:15.310
As we learned before, Kubernetes PODs can have multiple docker containers in them.

01:15.310 --> 01:22.960
In this case I modify my pod definition file to include an additional container called image-processor.

01:22.960 --> 01:25.290
If you ran the kubectl logs command

01:25.320 --> 01:32.080
now with the pod name, which container’s log would it show? If there are multiple containers within a

01:32.080 --> 01:32.950
pod.

01:32.980 --> 01:38.150
You must specify the name of the container explicitly in the command.

01:38.170 --> 01:41.940
Otherwise it would fail asking you to specify a name.

01:42.040 --> 01:48.700
In this case I will specify the name of the first container event-simulator and that prints the relevant

01:48.700 --> 01:50.590
log messages.

01:50.590 --> 01:55.930
Now, that is the simple logging functionality implemented within Kubernetes.

01:55.990 --> 02:01.860
And that is all that an application developer really needs to know to get started with Kubernetes.

02:02.110 --> 02:07.580
And that is all you really need to know as part of the certification program.

02:07.600 --> 02:14.080
However in the next lecture we will see more about some advanced logging configuration and third party

02:14.080 --> 02:16.510
support for logging in Kubernetes.

02:16.510 --> 02:24.710
We also have a nice demo that shows how a popular logging framework is integrated with kubernetes.

02:25.240 --> 02:27.100
Well that's it for this lecture.

02:27.100 --> 02:33.230
Head over to the coding exercises section and practice working with logs thank you.

