A Linux administrator is deploying an application on Kubernetes and needs to ensure that two containers (a web server and a caching service) share the same network and storage resources. Which of the following is the BEST option to achieve this requirement?
Deploy both containers within a single pod
Create a new Kubernetes service to facilitate communication between two standalone pods
Use a DaemonSet to ensure that both containers run on each node in the cluster
Launch separate pods for each container and use a service to link them
The correct answer is 'Deploy both containers within a single pod'. In Kubernetes, a Pod represents one or more containers that should be run together. Containers within the same pod share the same IP address, network, and storage resources, which means they can communicate with each other using 'localhost' and can access shared volumes. This is the exact scenario described, making it the ideal solution. The other options do not correctly represent how containers are co-located to share resources in the Kubernetes context. Creating separate pods for each container would not allow them to share network and storage resources directly. Configuring a service or deploying a DaemonSet would not target the issue at hand, which is the shared network and storage for closely related containers.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a pod in Kubernetes?
Open an interactive chat with Bash
How do containers in the same pod communicate?
Open an interactive chat with Bash
What are the advantages of using a pod for related containers?