KCNA · Question #63
What Linux namespace is shared by default by containers running within a Kubernetes Pod?
The correct answer is B. Network. Containers within the same Kubernetes Pod share the Network namespace by default, allowing them to communicate with each other via localhost.
Question
What Linux namespace is shared by default by containers running within a Kubernetes Pod?
Options
- AHost Network
- BNetwork
- CProcess ID
- DProcess Name
How the community answered
(25 responses)- B92% (23)
- C4% (1)
- D4% (1)
Why each option
Containers within the same Kubernetes Pod share the Network namespace by default, allowing them to communicate with each other via localhost.
Containers share the Host Network namespace only if explicitly configured with `hostNetwork: true`, which is not the default and generally discouraged for security reasons.
By default, all containers within a single Kubernetes Pod share the same Network namespace. This means they share the same IP address, network ports, and can communicate with each other via localhost, facilitating sidecar patterns and inter-container communication.
Containers within a Pod typically run in separate Process ID (PID) namespaces, meaning they have their own independent view of processes, although they can be configured to share one.
Process Name is not a standard Linux namespace that can be shared or isolated; Linux namespaces primarily include PID, Network, Mount, UTS, IPC, and User.
Concept tested: Kubernetes Pod container sharing, Linux namespaces
Source: https://kubernetes.io/docs/concepts/workloads/pods/#pod-s-ip-address
Topics
Community Discussion
No community discussion yet for this question.