<p>There are 6 kinds of namespaces in linux: <code>Network, UTS, Users, Mount, IPC, Pid</code>. I know that all the containers share the same network namespace with the pause container in a Kubernetes pod. And by default, different containers have different PID namespaces because they have different init process. However, how about other namespaces and why?</p>

<p>According to <a href="https://www.mirantis.com/blog/multi-container-pods-and-container-communication-in-kubernetes/" rel="noreferrer">this article</a>:</p>
<blockquote>
<p>Containers in a Pod run on a “logical host”; they use the same network namespace (in other words, the same IP address and port space), and the same IPC namespace.</p>
<p>Containers in a Pod share the same IPC namespace, which means they can also communicate with each other using standard inter-process communications such as SystemV semaphores or POSIX shared memory.</p>
<p>Containers in a Pod are accessible via “localhost”; they use the same network namespace. Also, for containers, the observable host name is a Pod’s name. Because containers share the same IP address and port space, you should use different ports in containers for incoming connections. In other words, applications in a Pod must coordinate their usage of ports.</p>
</blockquote>
<p>You can also <a href="https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/" rel="noreferrer">enable sharing Process namespace</a> between containers in a Pod by specifying <code>v1.PodSpec.shareProcessNamespace: true</code>.</p>
