If you are using patroni, you should change your parameters in patroni configuration yaml file, so the changes are reflected in your Distributed Configuration Store. If you would look at the Patroni documentation (https://patroni.readthedocs.io/en/latest/SETTINGS.html) you can find a note, that parameters like max_connections are stored in DCS and applied on all Patroni nodes overwriting settings from postgresql.conf. Also if Postgres was bootstrapped by Patroni, postgresql.conf itself should have a note:
# Do not edit this file manually! # It will be overwritten by Patroni!
PostgreSQL in our Production environment is configured using primary and secondary DB servers via Patroni. We have requirement to explicitly to set Max_Connection as 300 overriding default value. If we set Max_Connections in postgresql.config, it is getting reset post restart of Patroni.
Please advise us on the steps on how to configure and set Max_Connections in Replica DB servers.