Sidecar là container phụ trợ chạy cùng Pod với app chính để cung cấp chức năng gắn chặt như proxy service mesh, log shipper, config reloader hoặc local agent. Sidecar chia sẻ network và volumes với app container, nên phù hợp khi hai phần cần cùng lifecycle.
Ví dụ:
containers:
- name: app
image: api:1.0.0
- name: log-shipper
image: log-agent:1.0.0Sidecar tăng tài nguyên và complexity.
Chỉ dùng khi lifecycle/network/storage coupling thật sự cần cùng Pod.
A sidecar is a helper container running in the same Pod as the main app to provide tightly coupled functionality such as a service mesh proxy, log shipper, config reloader or local agent. It shares network and volumes with the app container, so it fits when both parts need the same lifecycle.
Example:
containers:
- name: app
image: api:1.0.0
- name: log-shipper
image: log-agent:1.0.0Sidecars increase resource use and complexity.
Use them only when lifecycle/network/storage coupling really needs the same Pod.