<p>I am working with containers that contain HTTP-based REST Apis. Each container contains one service.</p>
<p><a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/" rel="nofollow noreferrer">This</a> documentation page says that each pod has a unique IP address, from which I conclude that the service inside each container can be accessed by this IP address but with a specific port. It is also stated that a pod is associated with a storage volume such that all containers have access to it. My first question comes here : <strong>do the containers inside the same pod pick in the same physical memory also when they are run ?</strong></p>
<p>Reading documentation about pods reminded me of how I used to make multiple services interact with each other on my laptop. I opened them all on my laptop so they have the same IP address (localhost), and I could request one of the services by specifying the port it is listening to. So in my brain, I identified a <em>pod</em> to a laptop/a computer.
My second question would be: <strong>is this identification correct or misleading ?</strong></p>
<p>When I read further the documentation, I find that:</p>
<blockquote>
<p>A node is a worker machine ... and may be ... a physical machine</p>
</blockquote>
<p>and that pods run on nodes. Here I am confused. If a node is a worker machine, so a compute machine juste like my laptop, then it has a unique IP address. And this is is incompatible with the fact that nodes run pods and that each pod has it unique IP address. I'm assuming that if a node is a machine, then it has an IP address X, and all &quot;things&quot; inside this machine will also have the same IP address X, including the pods.
So I again ask my second question : <strong>is a pod a compute machine ?</strong></p>
<p>I think I need to sit down with someone that knows about the Kubernetes API, but not having such guy or girl, I'm trying here while continuing reading the docs!</p>

dada
<p>All valid questions demonstrating an inquisitive mind (not guaranteed in IT these days). To answer your questions:</p>
<p><strong>1. Do the containers inside the same Pod pick in the same physical memory also when they are run?</strong></p>
<p>Containers all run on the same Kernel and therefore share the same resources. Unlike VMs there is no virtualization layer isolating them. However, Container processes benefit from <strong>the same memory isolation as any other process running on a Linux kernel</strong>. On top of that, container processes can be limited to use not more than a certain amount of memory and CPU.</p>
<p><strong>2. Is this identification [Pods are like services running on a Laptop] correct or misleading?</strong></p>
<p>This identification only holds regarding <strong>networking</strong>: just like on your laptop all Pod containers run in the same network and therefore can address each other with <code>localhost</code>. However, unlike on your laptop, <strong>containers within Pods are still isolated from each other</strong>. They have their own file systems and run in separate process namespaces.</p>
<p><strong>3. Is a Pod a compute machine?</strong></p>
<p>A compute machine would be hardware (virtual or real) plus a operating system (kernel + applications) in my books. That means <strong>a Pod is not a compute machine</strong>. A Pod is merely a bunch of contained processes sharing a network namespace. In order to run a Pod, you need to provide hardware, Kernel and container runtime aka a K8s cluster.</p>
<p>Regarding networking: K8s worker machines have IP addresses assigned to them that make them addressable within their network or externally. Those IPs don't conflict with IPs assigned to Pods since Pod IPs are <strong>internal IPs</strong>. They are only addressable from within K8s virtual network, i.e. from other Pods within the same K8s cluster.</p>
