Patroni is the primary coordinating component of our stack. As we can see from diagram in The stack subsection, it is involved in every element of the stack to some degree. Although it ties all of the stack elements together, we're installing it next specifically because of how tightly it integrates with the key-value layer and PostgreSQL.
If a PostgreSQL server is already running, Patroni will adopt it. If not, Patroni will create a new instance based on how it's configured. We've already established that the key-value store distributes the same information across the entire cluster, so the first established server also becomes the primary node for the cluster. Any subsequent Patroni instance will start as, or transform itself into, a replica.
This means that it's critically important to get this part right. So, pay special...