Questão de Container Orchestration #019e3a4f
Which two elements are shared between containers in the same pod?
Network resources and liveness probes.
Storage and container image registry.
Storage and network resources.
Network resources and Dockerfiles.
Explicação Oficial / Explicações da Comunidade
In Kubernetes, a Pod is the smallest deployable unit that can contain one or more containers. Containers within the same Pod share two primary resources: network resources and storage.
How it Works
- Network Resources: All containers in a Pod share the same network namespace, meaning they share the same IP address, port space, and loopback interface. They can communicate with each other via
localhostand must coordinate port usage to avoid conflicts. - Storage: Containers in a Pod can share volumes (e.g.,
emptyDir,hostPath, or persistent volumes) that are mounted into each container's filesystem. This allows them to exchange data or access common configuration files.
Why the Correct Answer is Right
The correct answer states that storage and network resources are shared. This aligns with Kubernetes Pod design: containers in a Pod always share the network namespace and can optionally share storage volumes. The Pod's IP address is assigned to the Pod, not individual containers, and all containers use that IP.
Why the Incorrect Answers are Wrong
- Network resources and liveness probes: Liveness probes are not shared; each container can have its own probe configuration. Probes are per-container health checks, not a shared resource.
- Storage and container image registry: Container image registry is not a shared resource within a Pod. Each container specifies its own image from a registry. Storage can be shared, but the registry is external.
- Network resources and Dockerfiles: Dockerfiles are not shared; each container image is built from its own Dockerfile. Network resources are shared, but Dockerfiles are irrelevant to runtime sharing.
In summary, the Pod abstraction provides a shared network stack and the ability to share volumes, enabling tight coupling of containers when needed.