Multi-Containers Pod
Container images solve many real-world problems with existing packaging and deployment tools, but in addition to these significant benefits, containers offer us an opportunity to fundamentally re-think the way we build distributed applications. Just as service oriented architectures (SOA) encouraged the decomposition of applications into modular, focused services, containers should encourage the further decomposition of these services into closely cooperating modular containers. By virtue of establishing a boundary, containers enable users to build their services using modular, reusable components, and this in turn leads to services that are more reliable, more scalable and faster to build than applications built from monolithic containers.
Resources
-
Sidecar Logging
Application logs can help you understand what is happening inside your application.
-
Shared Volume Communication
Read about how to use a Volume to communicate between two Containers running in the same Pod.
-
Toolkit Patterns
Read Brendan Burns' blog post about "The Distributed System ToolKit: Patterns for Composite Containers".
-
Brendan Burns Paper
Read Brendan Burns' paper about design patterns for container-based distributed systems.
References
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
volumes:
- name: shared-data
emptyDir: {}
containers:
- name: app
image: bitnami/nginx
volumeMounts:
- name: shared-data
mountPath: /app
ports:
- containerPort: 8080
- name: sidecard
image: busybox
volumeMounts:
- name: shared-data
mountPath: /pod-data
command:
[
"sh",
"-c",
"echo Hello from the side container > /pod-data/index.html && sleep 3600",
]
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
shareProcessNamespace: true
containers:
- name: app
image: bitnami/nginx
ports:
- containerPort: 8080
- name: sidecard
image: busybox
securityContext:
capabilities:
add:
- SYS_PTRACE
stdin: true
tty: true
Activities
Task | Description | Link |
---|---|---|
Try It Yourself | ||
Multiple Containers | Build a container using legacy container image. | Multiple Containers |