Hello and welcome to this section on multi-container pods.
The idea of decoupling a large monolithic application
into sub-components known as microservices
enables us to develop and deploy a set of independent, small, and reusable code.
This architecture can then help us scale up, down,
as well as modify each service as required
as opposed to modifying the entire application.
However, at times, you may need two services to work together,
such as a web server and a logging service.
You need one agent instance per web server instance paired together.
You don't want to merge and bloat the code of the two services,
as each of them target different functionalities,
and you'd still like them to be developed and deployed separately.
You only need the two functionality to work together.
You need one agent per web server instance paired together
that can scale up and down together.
That is why you have multi-container pods that share the same life cycle,
which means they are created together and destroyed together.
They share the same network space,
which means they can refer to each other as local host,
and they have access to the same storage volumes.
This way, you do not have to establish
volume sharing or services between the pods
to enable communication between them.
To create a multi-container pod,
add the new container information to the pod definition file.
Remember, the container section
under the spec section in a pod definition file
is an array, and the reason it is an array
is to allow multiple containers in a single pod.
In this case, we add a new container named log-agent to our existing pod.
Well, that's it for this lecture.
Head over to the coding exercises section
and practice configuring multi-container pods.
See you in the next lecture.