What are the three main multi container pod design patterns described in the lecture?
The three main patterns are co located containers init containers and sidecar containers.
In the context of multi container pods what does the co located containers pattern mean?
The co located containers pattern means a pod that has two or more regular containers running together for the entire life of the pod.
When would you typically use the co located containers pattern?
You use the co located containers pattern when you have two services that depend on each other and both must run for the entire lifecycle of the pod.
How do containers appear in the pod spec when you use the co located containers pattern?
In the co located containers pattern all main containers are listed as elements in the containers array under the pod spec.
In the co located containers pattern what control do you have over which container starts first?
With co located containers you have no control over startup order and there is no guarantee which container will start first.
What is an init container in Kubernetes as described in the lecture?
An init container is a special container that runs before the main application containers performs setup work then exits so the main containers can start.
When would you typically use an init container pattern in a pod?
You use an init container when the pod must perform initialization steps before the main app can start such as waiting for a database or another service.
In the lecture what is an example of work done by an init container?
One example is an init container that runs a script to wait for a database to become ready before the main application starts.
Where are init containers defined in the pod specification?
Init containers are defined under a separate field named initContainers in the pod spec which uses a similar structure to the main containers field.
What happens to an init container after it finishes its work?
After an init container finishes its work it exits and does not continue running while the main application container runs.
How are multiple init containers executed if you define more than one in a pod?
Multiple init containers run sequentially in the order they appear so the first init container runs and exits then the second runs and exits and only after that do the main containers start.
In the lecture example what does a second init container called an API checker do?
The second init container named API checker waits for another API or service to be available before allowing the main application to start.
What is a sidecar container in Kubernetes as described in the lecture?
A sidecar container is a helper container that starts before the main application container but unlike a pure init container it keeps running for the entire life of the pod.
How is a sidecar container similar to an init container?
A sidecar container is defined using the same style as an init container and is designed to start before the main app so it can be ready when the main app starts.
How is a sidecar container different from a normal init container?
A normal init container exits after it finishes setup while a sidecar container is configured with a restart policy such as Always so it continues to run alongside the main application.
Why is a sidecar pattern useful for log shipping as described in the lecture?
A sidecar log shipper can start before the main app to capture startup logs run while the app is running and stop only after the app stops so it also captures termination logs.
In the lecture what real world style example is used to illustrate a sidecar container?
The lecture uses a log collection stack with Elasticsearch Kibana and a Filebeat sidecar where Filebeat runs as a sidecar to collect logs from the application container.
What is the main difference between the co located containers pattern and the sidecar pattern in terms of startup ordering?
In the co located pattern you cannot control which container starts first while in the sidecar pattern you deliberately arrange for the helper container to start before the main application.
Why can the co located containers and sidecar containers patterns be confusing at first?
Both patterns involve containers running for the entire life of the pod so the difference is subtle and mainly about whether you control startup ordering and explicit sidecar behavior.
How does the sidecar pattern ensure that the helper container starts before the main app?
The sidecar pattern uses configuration similar to init containers so the sidecar style container is started first then the main app container is started after the sidecar is ready.
According to the lecture what advantage does the sidecar pattern give for diagnostics when an application crashes?
When the application crashes the sidecar container continues long enough to capture termination logs which helps diagnose why the application ended unexpectedly.