Chapter 10. StatefulSets: deploying replicated stateful applications
- Deploying stateful clustered applications
- Providing separate storage for each instance of a replicated pod
- Guaranteeing a stable name and hostname for pod replicas
- Starting and stopping pod replicas in a predictable order
- Discovering peers through DNS SRV records
You now know how to run both single-instance and replicated stateless pods, and even stateful pods utilizing persistent storage. You can run several replicated web-server pod instances and you can run a single database pod instance that uses persistent storage, provided either through plain pod volumes or through Persistent-Volumes bound by a PersistentVolumeClaim. But can you employ a ReplicaSet to replicate the database pod?
ReplicaSets create multiple pod replicas from a single pod template. These replicas don’t differ from each other, apart from their name and IP address. If the pod template includes a volume, which refers to a specific PersistentVolumeClaim, all replicas of the ReplicaSet will use the exact same PersistentVolumeClaim and therefore the same PersistentVolume bound by the claim (shown in figure 10.1).