On which machine we should install WAL-G?
As WAL-G helps you both pushing and pulling backups and WAL to and from a storage, you have to install it on both the master and replica.
You can consider using a ready-made image, like Spilo, which would solve these issues for you.
Finally, there is official Patroni support on GitHub, you will get answers way faster there.