1
00:00:00,660 --> 00:00:03,650
Hello and welcome to this lecture. In this lecture

2
00:00:03,660 --> 00:00:12,130
we will talk about various Logging mechanisms in kubernetes. Let us start with logging in Docker. I run

3
00:00:12,130 --> 00:00:19,450
a docker container called event-simulator and all that it does is generate random events simulating a web

4
00:00:19,450 --> 00:00:20,580
server.

5
00:00:20,620 --> 00:00:25,020
These are events streamed to the standard output by the application.

6
00:00:25,030 --> 00:00:31,540
Now, if I were to run the docker container in the background, in a detached mode using the –d option,

7
00:00:32,200 --> 00:00:35,950
I wouldn't see the logs if I wanted to view the logs.

8
00:00:36,070 --> 00:00:43,030
I could use the docker logs command followed by the container ID. The –f option helps us see the

9
00:00:43,030 --> 00:00:45,020
live log trail.

10
00:00:45,130 --> 00:00:51,860
Now back to Kubernetes. We create a pod with the same docker image using the pod definition file.

11
00:00:52,210 --> 00:00:58,920
Once it’s the pod is running, we can view the logs using the kubectl logs command with the pod name.

12
00:00:59,150 --> 00:01:05,310
Use the –f option to stream  the logs live just like the docker command.

13
00:01:05,380 --> 00:01:09,940
Now these logs are specific to the container running inside the pod.

14
00:01:10,000 --> 00:01:15,310
As we learned before, Kubernetes PODs can have multiple docker containers in them.

15
00:01:15,310 --> 00:01:22,960
In this case I modify my pod definition file to include an additional container called image-processor.

16
00:01:22,960 --> 00:01:25,290
If you ran the kubectl logs command

17
00:01:25,320 --> 00:01:32,080
now with the pod name, which container’s log would it show? If there are multiple containers within a

18
00:01:32,080 --> 00:01:32,950
pod.

19
00:01:32,980 --> 00:01:38,150
You must specify the name of the container explicitly in the command.

20
00:01:38,170 --> 00:01:41,940
Otherwise it would fail asking you to specify a name.

21
00:01:42,040 --> 00:01:48,700
In this case I will specify the name of the first container event-simulator and that prints the relevant

22
00:01:48,700 --> 00:01:50,590
log messages.

23
00:01:50,590 --> 00:01:55,930
Now, that is the simple logging functionality implemented within Kubernetes.

24
00:01:55,990 --> 00:02:01,860
And that is all that an application developer really needs to know to get started with Kubernetes.

25
00:02:02,110 --> 00:02:07,580
And that is all you really need to know as part of the certification program.

26
00:02:07,600 --> 00:02:14,080
However in the next lecture we will see more about some advanced logging configuration and third party

27
00:02:14,080 --> 00:02:16,510
support for logging in Kubernetes.

28
00:02:16,510 --> 00:02:24,710
We also have a nice demo that shows how a popular logging framework is integrated with kubernetes.

29
00:02:25,240 --> 00:02:27,100
Well that's it for this lecture.

30
00:02:27,100 --> 00:02:33,230
Head over to the coding exercises section and practice working with logs thank you.
