Deploying the database

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

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 labs/ch13/db-stateful-set.yaml file. The details are as follows:

A StatefulSet for the ...

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