Patroni is the primary coordinating component of our stack. As we can see from figure 8-2, it is involved in every element of the stack to some degree. Though 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 it's critically important to get this part right. Pay special attention to this recipe!