Skip to Content
Kubernetes Patterns
book

Kubernetes Patterns

by Bilgin Ibryam, Roland Huß
April 2019
Intermediate to advanced
266 pages
6h 6m
English
O'Reilly Media, Inc.
Content preview from Kubernetes Patterns

Chapter 17. Ambassador

The Ambassador pattern is a specialized Sidecar responsible for hiding complexity and providing a unified interface for accessing services outside the Pod. In this chapter, we see how the Ambassador pattern can act as a proxy and decouple the main Pod from directly accessing external dependencies.

Problem

Containerized services don’t exist in isolation and very often have to access other services that may be difficult to reach in a reliable way. The difficulty in accessing other services may be due to dynamic and changing addresses, the need for load balancing of clustered service instances, an unreliable protocol, or difficult data formats. Ideally, containers should be single-purposed and reusable in different contexts. But if we have a container that provides some business functionality and consumes an external service in a specialized way, the container will have more than one responsibility.

Consuming the external service may require a special service discovery library that we do not want to put in our container. Or we may want to swap different kinds of services by using different kinds of service discovery libraries and methods. This technique of abstracting and isolating the logic for accessing other services in the outside world is the goal of this Ambassador pattern.

Solution

To demonstrate the pattern, we will use a cache for an application. Accessing a local cache in the development environment may be a simple configuration, but in the production ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Microservices

Kubernetes Microservices

Richard Chesterwood
Kubernetes: Up and Running

Kubernetes: Up and Running

Kelsey Hightower, Brendan Burns, Joe Beda

Publisher Resources

ISBN: 9781492050278Errata PageSupplemental Content