Member-only story
Mastering Kubernetes: The Art of Pod Composition
Beyond Single Containers: The Power of Pod Patterns in Kubernetes
Explore key design patterns that streamline deployment, enhance functionality, and ensure application resilience in Kubernetes environments.
Reasons to have multiple containers running inside a pod: It may not make sense to recreate an entire image to add functionality like a shell or logging agent. Instead, you could add another container to the Pod, which would provide the necessary tools.
Each container in the Pod should be transient and decoupled. If adding another container limits the scalability or transient nature of the original application, then a new build may be warranted.
Every container in a Pod shares a single IP address and namespace. Each container has equal potential access to storage given to the Pod. Kubernetes does not provide any locking, so your configuration or application should be such that containers do not have conflicting writes.
One container could be read only while the other writes. You could configure the containers to write to different directories in the volume, or the application could have built in locking. Without these…