Deploying the database

A database is a stateful component and has to be treated differently to stateless components, such as our web component. We discussed the difference between stateful and stateless components in a distributed application architecture in detail in Chapter 9Distributed Application Architecture, and Chapter 12Orchestrators.

Kubernetes has defined a special type of ReplicaSet object for stateful components. The object is called a StatefulSet. Let's use this kind of object to deploy our database. The definition can be found in the ~fod/ch16/db-stateful-set.yaml file. The details are as follows:

A StatefulSet for the DB ...

Get Learn Docker - Fundamentals of Docker 19.x - Second 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.