Chapter 16. Sidecar

A sidecar container extends and enhances the functionality of a preexisting container without changing it. The Sidecar pattern is one of the fundamental container patterns that allows single-purpose containers to cooperate closely together. In this chapter, you’ll learn all about the basic sidecar concept. The specialized follow-up patterns, Adapter and Ambassador, are discussed in Chapters 17 and 18, respectively.

Problem

Containers are a popular packaging technology that allow developers and system administrators to build, ship, and run applications in a unified way. A container represents a natural boundary for a unit of functionality with a distinct runtime, release cycle, API, and team owning it. A proper container behaves like a single Linux process—solves one problem and does it well—and is created with the idea of replaceability and reuse. This last part is essential as it allows us to build applications more quickly by leveraging existing specialized containers.

Today, to make an HTTP call, we don’t have to write a client library but can use an existing one. In the same way, to serve a website, we don’t have to create a container for a web server but can use an existing one. This approach allows developers to avoid reinventing the wheel and create an ecosystem with a smaller number of better-quality containers to maintain. However, having single-purpose reusable containers requires ways of extending the functionality of a container and a means for ...

Get Kubernetes Patterns, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.