WEBVTT

00:00.417 --> 00:04.129
Hello and welcome to this section
on multi-container pods.

00:04.453 --> 00:08.453
The idea of decoupling
a large monolithic application

00:08.453 --> 00:12.516
into sub-components
known as microservices

00:12.516 --> 00:18.583
enables us to develop and deploy a set of
independent, small, and reusable code.

00:19.469 --> 00:24.172
This architecture can then help us
scale up, down,

00:24.172 --> 00:27.792
as well as modify
each service as required

00:28.000 --> 00:31.464
as opposed to modifying
the entire application.

00:32.323 --> 00:36.844
However, at times, you may need
two services to work together,

00:37.104 --> 00:40.125
such as a web server 
and a logging service.

00:40.281 --> 00:45.349
You need one agent instance
per web server instance paired together.

00:45.583 --> 00:49.271
You don't want to merge and bloat
the code of the two services,

00:49.271 --> 00:52.995
as each of them target
different functionalities,

00:52.995 --> 00:57.266
and you'd still like them
to be developed and deployed separately.

00:58.073 --> 01:01.839
You only need the two functionality
to work together.

01:02.542 --> 01:06.708
You need one agent per web server instance
paired together

01:06.708 --> 01:09.573
that can scale up and down together.

01:10.536 --> 01:15.474
That is why you have multi-container pods
that share the same life cycle,

01:15.474 --> 01:19.563
which means they are created together
and destroyed together.

01:19.797 --> 01:21.932
They share the same network space,

01:21.932 --> 01:25.396
which means they can refer to each other
as local host,

01:25.708 --> 01:28.755
and they have access
to the same storage volumes.

01:29.302 --> 01:31.844
This way,
you do not have to establish

01:31.844 --> 01:35.177
volume sharing or services
between the pods

01:35.359 --> 01:38.016
to enable communication
between them.

01:38.458 --> 01:40.609
To create a multi-container pod,

01:40.609 --> 01:44.620
add the new container information
to the pod definition file.

01:44.854 --> 01:47.005
Remember, the container section

01:47.005 --> 01:49.817
under the spec section
in a pod definition file

01:49.984 --> 01:52.615
is an array,
and the reason it is an array

01:52.615 --> 01:56.078
is to allow multiple containers
in a single pod.

01:56.495 --> 02:01.977
In this case, we add a new container
named log-agent to our existing pod.

02:02.419 --> 02:04.555
Well, that's it for this lecture.

02:04.555 --> 02:07.003
Head over to
the coding exercises section

02:07.003 --> 02:10.518
and practice configuring
multi-container pods.

02:10.674 --> 02:12.541
See you in the next lecture.

