title: Kubernetes postgres replication with pgpool
body: <p>Trying to deploy postgres in kubernetes (<a href="https://github.com/paunin/PostDock/tree/master/k8s/example2-single-statefulset" rel="nofollow noreferrer">https://github.com/paunin/PostDock/tree/master/k8s/example2-single-statefulset</a>), </p>
  
  <ol>
  <li>Used pgpool-II(2 replicas) along with 1 postgres-master pod &amp; 2 slave pods. </li>
  </ol>
  
  <pre><code>kubectl get pods -n postgres
  NAME                                       READY   STATUS    RESTARTS   AGE
  psql-db-pgpool-8****c-7**k             1/1     Running   0          35d
  psql-db-pgpool-8****c-m**5             1/1     Running   0          35d
  psql-db-node-0                         1/1     Running   0          35d
  psql-db-node-1                         1/1     Running   0          35d
  psql-db-node-2                         1/1     Running   0          20h
  </code></pre>
  
  <ol start="2">
  <li>Created a user "test" from the master postgres db with postgres user. </li>
  <li>When trying to connect from within the pods(node-0), the authentication is successful, with user "test".</li>
  </ol>
  
  <pre><code>root@postgres-db-node-0:/# psql -h localhost postgres -U test
  psql (11.4 (Debian 11.4-1.pgdg90+1))
  Type "help" for help.
  
  postgres=&gt; \l
  </code></pre>
  
  <ol>
  <li>When trying to connect with NodePort IP &amp; NodePort of the kubernetes cluster, the new user "test" fails authentication with <strong>pool_passwd file does not contain an entry for "test"</strong></li>
  </ol>
  
  <pre><code>psql -h NODE_IP -U test -d postgres --port NODE_PORT
  psql: FATAL:  md5 authentication failed
  DETAIL:  pool_passwd file does not contain an entry for "test"
  </code></pre>
  
  <ol start="5">
  <li>Logged in to the pgpool-II pod to find out </li>
  </ol>
  
  <pre><code>root@psql-db-pgpool-8****c-7**k:/# cat /usr/local/etc/pool_passwd
  user1:md5****422f
  replica_user:md5****3
  </code></pre>
  
  <p>The new user "test" created at the database is not reflected at the pgpool. Does it work this way, to create &amp; update pgpool everytime a new user is created? Or am I missing something for this user update.</p>