liveBook · Manning

Database

As explained in Road to Kubernetes

A database is a system that persistently stores and manages structured or semi-structured data for applications.

A database is a stateful data store: its application may run in a container, but the data it reads and writes must persist in a storage volume. This persistence makes databases more complex to deploy than stateless web applications. section 8.4.2 section 1.6

Deploying a database with Kubernetes requires coordinating:

  • A persistent volume so data survives beyond the container. section 8.4.2
  • A StatefulSet that gives each Pod a volume, predictable name, and ordered creation and deletion. section 8.4.2

PostgreSQL with a StatefulSet

A PostgreSQL deployment requests a 20Gi retained block-storage volume, mounts it at /var/lib/postgresql, loads credentials from a Secret, and exposes port 5432 through a ClusterIP Service. An init container removes the volume's lost+found directory before PostgreSQL starts. A StatefulSet can run the database with persistent storage, but multiple replicas do not automatically form a PostgreSQL cluster. section 8.4.2

How Road to Kubernetes covers it

How deep it goes
Explains database deployment through volumes, StatefulSets, Secrets, initialization, and Services, but defers clustered-database construction.
Examples
Uses PostgreSQL manifests with credentials, a 20Gi volume claim, an init container, and a ClusterIP Service.
What you can do after
Operate/configure PostgreSQL on Kubernetes with persistent storage, Secret-backed credentials, and internal Service connectivity.
How it connects
Connects databases with containers, persistent volumes, StatefulSets, Secrets, Services, and stateful applications.

Also explained in

Compare how 24 books explain database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.