Kubernetes uses the etcd key-value store for its control plane (Master) database, and Docker Swarm Managers use a built-in data store that is similar to etcd. Both use the Raft Algorithm to communicate between these control plane nodes safely and make decisions about state.
Here’s Laura Frank Tacho’s talk on a lot of these topics, with some more details in links below that: