I read that a pod often only has 1 container.
Does this mean that I should have 2 pods: 1 React and 1 Node.js?
What if I have a web server like nginx running in front of the React frontend? Then React + nginx = 2 containers = 1 Frontend pod and 1 Node.js pod?
Kubernetes's smallest deployment unit is Pod. There are some cases like
Think about traditional databases and frontend systems. Do you scale the underlying database system while scaling your frontend systems. So When it comes to same pod definition or different pod definitions for multiple containers we should think about scaling and security.
"pod often only has 1 container". No it doesn't mean that you should have two Pods for your application. You can use two Containers in a Pod.
Each Pod is assigned a unique IP address. Every container in a Pod shares the network namespace, including the IP address and network ports. Containers inside a Pod can communicate with one another using localhost. When containers in a Pod communicate with entities outside the Pod, they must coordinate how they use the shared network resources (such as ports).
If you need to share same Network namespace, you need to keep them in a Pod.
Also, it depends on purpose. You can group multiple process together if they fulfill similar purpose. If an application needs several process running on the same host, you can use multiple containers.
This blog post explains some Use Cases: www.mirantis.com/blog