Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/postgresql] Database defined by postgresqlDatabase is not always created #14533

Closed
POD666 opened this issue Jun 5, 2019 · 19 comments
Closed

Comments

@POD666
Copy link

POD666 commented Jun 5, 2019

Some of my deployments (1 of 10) fails because the database defined by postgresqlDatabase was not created.

The issue was reproduced for PostgreSQL chart version 4.0.0 and 5.3.0.

I have the following values in values.yml:

postgresql:
  image:
    tag: "9.6"
  persistence:
    enabled : false
  postgresqlUsername: "mydb"
  postgresqlPassword: "mydb"
  postgresqlDatabase: "mydb"
  initdbScripts:
    init_anotherdb.sh: |
      #!/bin/sh
      set -e
      echo "Create DATABASE anotherdb with OWNER anotherdb:"
      psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "template1" <<-EOSQL
        CREATE USER anotherdb WITH PASSWORD 'anotherdb';
        CREATE DATABASE anotherdb;
        GRANT ALL PRIVILEGES ON DATABASE anotherdb TO anotherdb;
      EOSQL
      echo "Done."

Log:

$ kubectl logs test-psql-9-qa-postgresql-0 
 16:01:03.96 
 16:01:03.96 Welcome to the Bitnami postgresql container
 16:01:03.96 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 16:01:03.96 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 16:01:03.96 Send us your feedback at [email protected]
 16:01:03.97 
 16:01:04.01 INFO  ==> ** Starting PostgreSQL setup **
 16:01:04.10 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 16:01:04.11 INFO  ==> Initializing PostgreSQL database...
 16:01:04.12 INFO  ==> postgresql.conf file not detected. Generating it...
 16:01:04.12 INFO  ==> pg_hba.conf file not detected. Generating it...
 16:01:05.95 INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
 16:01:06.97 INFO  ==> Creating user mydb
 16:01:06.99 INFO  ==> Grating access to "mydb" to the database "postgres"
 16:01:07.02 INFO  ==> Configuring replication parameters
 16:01:07.03 INFO  ==> Configuring fsync
 16:01:07.04 INFO  ==> Loading custom scripts...
 16:01:07.04 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
 16:01:07.04 INFO  ==> Starting PostgreSQL in background...
Create DATABASE anotherdb with OWNER anotherdb:
CREATE ROLE
CREATE DATABASE
GRANT
Done.
 16:01:07.30 INFO  ==> Enabling remote connections
 16:01:07.31 INFO  ==> Stopping PostgreSQL...
 16:01:08.32 INFO  ==> ** PostgreSQL setup finished! **

 16:01:08.39 INFO  ==> ** Starting PostgreSQL **
LOG:  database system was shut down at 2019-06-05 16:01:07 GMT
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
FATAL:  database "mydb" does not exist
FATAL:  database "mydb" does not exist
FATAL:  database "mydb" does not exist
...

Env variables seem to be set as expected:

Key Value
POSTGRESQL_PORT_NUMBER 5432
POSTGRES_USER mydb
POSTGRES_DB mydb
PGDATA /bitnami/postgresql/data
BITNAMI_DEBUG false
YAML:
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  creationTimestamp: 2019-06-05T16:00:57Z
  generation: 1
  labels:
    app: postgresql
    chart: postgresql-5.3.0
    heritage: Tiller
    release: test-psql-9-qa
  name: test-psql-9-qa-postgresql
  namespace: default
  resourceVersion: "312005697"
  selfLink: /apis/apps/v1beta2/namespaces/default/statefulsets/test-psql-9-qa-postgresql
  uid: 1b44b6b1-87ab-11e9-b483-0695c975bcf2
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: postgresql
      release: test-psql-9-qa
      role: master
  serviceName: test-psql-9-qa-postgresql-headless
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: postgresql
        chart: postgresql-5.3.0
        heritage: Tiller
        release: test-psql-9-qa
        role: master
      name: test-psql-9-qa-postgresql
    spec:
      containers:
      - env:
        - name: BITNAMI_DEBUG
          value: "false"
        - name: POSTGRESQL_PORT_NUMBER
          value: "5432"
        - name: PGDATA
          value: /bitnami/postgresql/data
        - name: POSTGRES_USER
          value: mydb
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              key: postgresql-password
              name: test-psql-9-qa-postgresql
        - name: POSTGRES_DB
          value: mydb
        image: docker.io/bitnami/postgresql:9.6
        imagePullPolicy: Always
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - exec pg_isready -U "mydb" -d "mydb" -h 127.0.0.1 -p 5432
          failureThreshold: 6
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        name: test-psql-9-qa-postgresql
        ports:
        - containerPort: 5432
          name: postgresql
          protocol: TCP
        readinessProbe:
          exec:
            command:
            - sh
            - -c
            - pg_isready -U "mydb" -d "mydb" -h 127.0.0.1 -p 5432 && [ -f /opt/bitnami/postgresql/tmp/.initialized
              ]
          failureThreshold: 6
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        resources:
          requests:
            cpu: 250m
            memory: 256Mi
        securityContext:
          procMount: Default
          runAsUser: 1001
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /docker-entrypoint-initdb.d/
          name: custom-init-scripts
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 1001
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: test-psql-9-qa-postgresql-init-scripts
        name: custom-init-scripts
      - emptyDir: {}
        name: data
  updateStrategy:
    type: RollingUpdate
status:
  collisionCount: 0
  currentReplicas: 1
  currentRevision: test-psql-9-qa-postgresql-857c76f9c7
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updateRevision: test-psql-9-qa-postgresql-857c76f9c7
  updatedReplicas: 1

Is there anything else I can add?

@juan131
Copy link
Collaborator

juan131 commented Jun 7, 2019

Hi @POD666 I was unable to reproduce your issue using the values.yaml below:

image:
  tag: "9.6"
  debug: true
persistence:
  enabled : false
postgresqlUsername: "mydb"
postgresqlPassword: "mydb"
postgresqlDatabase: "mydb"
initdbScripts:
  init_anotherdb.sh: |
    #!/bin/sh
    set -e
    echo "Create DATABASE anotherdb with OWNER anotherdb:"
    psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "template1" <<-EOSQL
      CREATE USER anotherdb WITH PASSWORD 'anotherdb';
      CREATE DATABASE anotherdb;
      GRANT ALL PRIVILEGES ON DATABASE anotherdb TO anotherdb;
    EOSQL
    echo "Done."

Commands used:

$ helm search stable/postgresql
NAME             	CHART VERSION	APP VERSION	DESCRIPTION
stable/postgresql	5.3.4        	11.3.0     	Chart for PostgreSQL, an object-relational database manag...
$ helm install stable/postgresql --name postgresql -f values.yaml
$ kubectl logs -f postgresql-postgresql-0
...
 07:48:42.44 INFO  ==> Loading custom scripts...
 07:48:42.44 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
 07:48:42.45 INFO  ==> Starting PostgreSQL in background...
 07:48:42.46 DEBUG ==> Sourcing /docker-entrypoint-initdb.d/..2019_06_07_07_48_23.415067750/init_anotherdb.sh
Create DATABASE anotherdb with OWNER anotherdb:
CREATE ROLE
CREATE DATABASE
GRANT
Done.
 07:48:43.03 INFO  ==> Enabling remote connections
 07:48:43.05 INFO  ==> Stopping PostgreSQL...
...
 07:48:44.07 INFO  ==> ** PostgreSQL setup finished! **
 07:48:44.12 INFO  ==> ** Starting PostgreSQL **
$ export POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgresql-postgresql -o $ kubectl run postgresql-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:9.6 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql-postgresql -U mydb -d mydb -p 5432
If you don't see a command prompt, try pressing enter.

mydb=> \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+------------------------
 anotherdb | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | anotherdb=CTc/postgres
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres           +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres           +
           |

As you can see the script is being executed and the databases mydb and anotherdb are created.

@POD666
Copy link
Author

POD666 commented Jun 7, 2019

It's flaky, try this few times until it fails:

helm install stable/postgresql --name postgresql-test -f values.yaml

kubectl exec $(kubectl get pod -l release=postgresql-test -o jsonpath="{.items[0].metadata.name}") -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'

helm del --purge postgresql-test

Here is what I get, the first attempt is successful and the second one failed:

$ helm install stable/postgresql --name postgresql-test -f values.yaml
NAME:   postgresql-test
LAST DEPLOYED: Fri Jun  7 15:36:17 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME                                     DATA  AGE
postgresql-test-postgresql-init-scripts  1     1s

==> v1/Pod(related)
NAME                          READY  STATUS             RESTARTS  AGE
postgresql-test-postgresql-0  0/1    ContainerCreating  0         1s

==> v1/Secret
NAME                        TYPE    DATA  AGE
postgresql-test-postgresql  Opaque  1     1s

==> v1/Service
NAME                                 TYPE       CLUSTER-IP     EXTERNAL-IP  PORT(S)   AGE
postgresql-test-postgresql           ClusterIP  100.70.27.109  <none>       5432/TCP  1s
postgresql-test-postgresql-headless  ClusterIP  None           <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                        READY  AGE
postgresql-test-postgresql  0/1    1s

NOTES:
...

WARNING: Rolling tag detected (bitnami/postgresql:9.6), please note that it is strongly recommended to avoid using rolling tags in a production environment.
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/

$ kubectl exec $(kubectl get pod -l release=postgresql-test -o jsonpath="{.items[0].metadata.name}") -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges    
-----------+----------+----------+-------------+-------------+------------------------
 anotherdb | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | anotherdb=CTc/postgres
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres           +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres           +
           |          |          |             |             | postgres=CTc/postgres
(5 rows)

$ helm del --purge postgresql-test
release "postgresql-test" deleted
$ helm install stable/postgresql --name postgresql-test -f values.yaml
NAME:   postgresql-test
LAST DEPLOYED: Fri Jun  7 15:36:40 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME                                     DATA  AGE
postgresql-test-postgresql-init-scripts  1     1s

==> v1/Pod(related)
NAME                          READY  STATUS             RESTARTS  AGE
postgresql-test-postgresql-0  0/1    ContainerCreating  0         1s

==> v1/Secret
NAME                        TYPE    DATA  AGE
postgresql-test-postgresql  Opaque  1     1s

==> v1/Service
NAME                                 TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
postgresql-test-postgresql           ClusterIP  100.66.192.251  <none>       5432/TCP  1s
postgresql-test-postgresql-headless  ClusterIP  None            <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                        READY  AGE
postgresql-test-postgresql  0/1    1s

NOTES:
...

WARNING: Rolling tag detected (bitnami/postgresql:9.6), please note that it is strongly recommended to avoid using rolling tags in a production environment.
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/

$ kubectl exec $(kubectl get pod -l release=postgresql-test -o jsonpath="{.items[0].metadata.name}") -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
psql: FATAL:  role "mydb" does not exist
command terminated with exit code 2

Right before creating this issue, It was reproduced with 9th attempt.

@juan131
Copy link
Collaborator

juan131 commented Jun 10, 2019

Hi @POD666

What did you obtain in the logs when it failed? Could you please share it.

$ kubectl logs -f postgresql-postgresql-0

@tompizmor
Copy link
Collaborator

For the record, I tried 20 times with the chart postgresql-5.3.4 and it worked 20/20.

@POD666
Copy link
Author

POD666 commented Jun 11, 2019

the chart postgresql-4.0.0

$ kubectl logs -f postgresql-test-postgresql-0

Welcome to the Bitnami postgresql container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
Send us your feedback at [email protected]

INFO  ==> ** Starting PostgreSQL setup **
INFO  ==> Validating settings in POSTGRESQL_* env vars..
INFO  ==> Initializing PostgreSQL database...
INFO  ==> postgresql.conf file not detected. Generating it...
INFO  ==> pg_hba.conf file not detected. Generating it...
INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
INFO  ==> Creating user mydb
INFO  ==> Grating access to "mydb" to the database "postgres"
INFO  ==> Configuring replication parameters
INFO  ==> Configuring fsync
INFO  ==> Loading custom scripts...
INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
INFO  ==> Starting PostgreSQL in background...
Create DATABASE anotherdb with OWNER anotherdb:
CREATE ROLE
CREATE DATABASE
GRANT
Done.
INFO  ==> Enabling remote connections
INFO  ==> Stopping PostgreSQL...
INFO  ==> ** PostgreSQL setup finished! **

INFO  ==> ** Starting PostgreSQL **
LOG:  database system was shut down at 2019-06-10 15:48:08 GMT
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
FATAL:  database "mydb" does not exist
FATAL:  database "mydb" does not exist
FATAL:  database "mydb" does not exist
FATAL:  database "mydb" does not exist
...

Looks like problem is here: Grating access to "mydb" to the database "postgres".
Successful deployments have the following message Grating access to "mydb" to the database "mydb".
But env variables seems to be fine:

POSTGRES_PASSWORD= mydb
POSTGRES_USER= mydb
POSTGRES_DB= mydb

I will try to reproduce it on the latest master but It already was reproduced for 5.3.0.

@POD666
Copy link
Author

POD666 commented Jun 11, 2019

I have also failed to reproduce it on the latest master with a number of attempts but you should be able to reproduce it at git checkout 12387212edc588cbc445370479253146ca0c3aa6 (4.0.*) and at git checkout 555cd7cbd685ce6077a04a432e13b03c5af9d303 (5.3.0).

@POD666
Copy link
Author

POD666 commented Jun 11, 2019

I have walked through changes since 5.3.0 and see nothing suspicious, except this.
Can you confirm issue at 4.0.0 or 5.3.0?

@POD666
Copy link
Author

POD666 commented Jun 11, 2019

Well, yes, reproduced at git checkout bf1174b2e9bead6396f039df60b53fdb7a86ba3a which is parent of that one. And at the git checkout 691a770df564a9bf9bfefcfbcc09f56d97b83df5 it wasn't reproduced after few attempts.

So looks like I can just upgrade to 5.3.7 to solve my issue.

@POD666
Copy link
Author

POD666 commented Jun 12, 2019

I have no idea how .Values.extraEnv is related to .Values.postgresqlDatabase and why @tompizmor failed to reproduce the issue. 😕

Just for notice

$ helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.0", GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}

@tompizmor
Copy link
Collaborator

I am afraid I am unable to reproduce it on postgresql-4.0.0 nor postgresql-5.3.0.

I am using this command to deploy the chart 10 times:

for i in `seq 1 10`; helm install stable/postgresql --name psql-$i -f values.yaml --version 5.3.0 ; done

I also tried the same using --version 4.0.0

The values.yaml file is:

persistence:
  enabled : false
postgresqlUsername: "mydb"
postgresqlPassword: "mydb"
postgresqlDatabase: "mydb"
initdbScripts:
  init_anotherdb.sh: |
    #!/bin/sh
    set -e
    echo "Create DATABASE anotherdb with OWNER anotherdb:"
    psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "template1" <<-EOSQL
      CREATE USER anotherdb WITH PASSWORD 'anotherdb';
      CREATE DATABASE anotherdb;
      GRANT ALL PRIVILEGES ON DATABASE anotherdb TO anotherdb;
    EOSQL
    echo "Done."

Then in order to check the dbs were creates:

kubectl exec $(kubectl get pod -l release=psql-ID -o jsonpath="{.items[0].metadata.name}") -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'

Being ID the chart index.

My helm versions here:

Client: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

Could you exec into one of those pods and execute this command to get the exact postgresql image used?

env | grep -i BITNAMI_IMAGE_VERSION

@POD666
Copy link
Author

POD666 commented Jun 12, 2019

Upgraded to

$ helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}

The issue persist for 4.1.0 and for 5.3.4, but not for 5.3.7.

$ kubectl exec postgresql-test-postgresql-0 -- sh -c 'env | grep -i BITNAMI_IMAGE_VERSION';
BITNAMI_IMAGE_VERSION=9.6.13-debian-9-r39

What else can be different and be a reason why it's so hard to reproduce the issue?

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.3", GitCommit:"435f92c719f279a3a67808c80521ea17d5715c66", GitTreeState:"clean", BuildDate:"2018-11-26T12:46:57Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

@POD666
Copy link
Author

POD666 commented Jun 13, 2019

I was wrong, the issue persists for 5.3.7.

@POD666
Copy link
Author

POD666 commented Jun 13, 2019

I can reproduce the issue even with very simple values.yaml

postgresqlUsername: "mydb"
postgresqlPassword: "mydb"
postgresqlDatabase: "mydb"

here is my full testing script:

set -x

echo 'postgresqlUsername: "mydb"' > values.yaml
echo 'postgresqlPassword: "mydb"' >> values.yaml
echo 'postgresqlDatabase: "mydb"' >> values.yaml
cat values.yaml

helm repo update
helm version
kubectl version


for i in `seq 1 10`; do helm install stable/postgresql --name psql-test-$i -f values.yaml --version 5.3.8; done

sleep 60

for i in `seq 1 10`; do kubectl exec psql-test-$i-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'; done
for i in `seq 1 10`; do kubectl logs psql-test-$i-postgresql-0; done
for i in `seq 1 10`; do helm del --purge psql-test-$i; done

And here is output (sploiler: 5,6,7,10 failed):

Click to expand
$ ./test.sh 
++ echo 'postgresqlUsername: "mydb"'
++ echo 'postgresqlPassword: "mydb"'
++ echo 'postgresqlDatabase: "mydb"'
++ cat values.yaml
postgresqlUsername: "mydb"
postgresqlPassword: "mydb"
postgresqlDatabase: "mydb"
++ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "k8s-jmeter" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete.
++ helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
++ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.3", GitCommit:"435f92c719f279a3a67808c80521ea17d5715c66", GitTreeState:"clean", BuildDate:"2018-11-26T12:46:57Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
+++ seq 1 10
++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-1 -f values.yaml --version 5.3.8
NAME:   psql-test-1
LAST DEPLOYED: Thu Jun 13 14:38:24 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-1-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-1-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
psql-test-1-postgresql           ClusterIP  100.70.244.163  <none>       5432/TCP  1s
psql-test-1-postgresql-headless  ClusterIP  None            <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-1-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-1-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-1-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-1-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-1-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-1-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-2 -f values.yaml --version 5.3.8
NAME:   psql-test-2
E0613 14:37:31.747914   22154 portforward.go:372] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:63463->127.0.0.1:63467: write tcp4 127.0.0.1:63463->127.0.0.1:63467: write: broken pipe
LAST DEPLOYED: Thu Jun 13 14:38:29 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-2-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-2-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
psql-test-2-postgresql           ClusterIP  100.65.133.157  <none>       5432/TCP  1s
psql-test-2-postgresql-headless  ClusterIP  None            <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-2-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-2-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-2-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-2-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-2-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-2-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-3 -f values.yaml --version 5.3.8
NAME:   psql-test-3
LAST DEPLOYED: Thu Jun 13 14:38:34 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-3-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-3-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
psql-test-3-postgresql           ClusterIP  100.65.246.141  <none>       5432/TCP  1s
psql-test-3-postgresql-headless  ClusterIP  None            <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-3-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-3-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-3-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-3-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-3-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-3-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-4 -f values.yaml --version 5.3.8
NAME:   psql-test-4
LAST DEPLOYED: Thu Jun 13 14:38:40 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-4-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-4-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP     EXTERNAL-IP  PORT(S)   AGE
psql-test-4-postgresql           ClusterIP  100.66.246.76  <none>       5432/TCP  1s
psql-test-4-postgresql-headless  ClusterIP  None           <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-4-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-4-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-4-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-4-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-4-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-4-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-5 -f values.yaml --version 5.3.8
NAME:   psql-test-5
LAST DEPLOYED: Thu Jun 13 14:38:45 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-5-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-5-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
psql-test-5-postgresql           ClusterIP  100.71.251.146  <none>       5432/TCP  1s
psql-test-5-postgresql-headless  ClusterIP  None            <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-5-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-5-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-5-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-5-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-5-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-5-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-6 -f values.yaml --version 5.3.8
NAME:   psql-test-6
LAST DEPLOYED: Thu Jun 13 14:38:53 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-6-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-6-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP     EXTERNAL-IP  PORT(S)   AGE
psql-test-6-postgresql           ClusterIP  100.64.122.91  <none>       5432/TCP  1s
psql-test-6-postgresql-headless  ClusterIP  None           <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-6-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-6-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-6-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-6-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-6-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-6-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-7 -f values.yaml --version 5.3.8
NAME:   psql-test-7
LAST DEPLOYED: Thu Jun 13 14:38:58 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-7-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-7-postgresql  Opaque  1     2s

==> v1/Service
NAME                             TYPE       CLUSTER-IP     EXTERNAL-IP  PORT(S)   AGE
psql-test-7-postgresql           ClusterIP  100.68.73.130  <none>       5432/TCP  1s
psql-test-7-postgresql-headless  ClusterIP  None           <none>       5432/TCP  2s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-7-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-7-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-7-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-7-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-7-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-7-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-8 -f values.yaml --version 5.3.8
NAME:   psql-test-8
LAST DEPLOYED: Thu Jun 13 14:39:03 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-8-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-8-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP     EXTERNAL-IP  PORT(S)   AGE
psql-test-8-postgresql           ClusterIP  100.67.251.41  <none>       5432/TCP  1s
psql-test-8-postgresql-headless  ClusterIP  None           <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-8-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-8-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-8-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-8-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-8-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-8-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-9 -f values.yaml --version 5.3.8
NAME:   psql-test-9
LAST DEPLOYED: Thu Jun 13 14:39:08 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                      READY  STATUS    RESTARTS  AGE
psql-test-9-postgresql-0  0/1    Init:0/1  0         1s

==> v1/Secret
NAME                    TYPE    DATA  AGE
psql-test-9-postgresql  Opaque  1     1s

==> v1/Service
NAME                             TYPE       CLUSTER-IP    EXTERNAL-IP  PORT(S)   AGE
psql-test-9-postgresql           ClusterIP  100.67.29.46  <none>       5432/TCP  1s
psql-test-9-postgresql-headless  ClusterIP  None          <none>       5432/TCP  1s

==> v1beta2/StatefulSet
NAME                    READY  AGE
psql-test-9-postgresql  0/1    1s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-9-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-9-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-9-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-9-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-9-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ for i in '`seq 1 10`'
++ helm install stable/postgresql --name psql-test-10 -f values.yaml --version 5.3.8
NAME:   psql-test-10
LAST DEPLOYED: Thu Jun 13 14:39:14 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod(related)
NAME                       READY  STATUS    RESTARTS  AGE
psql-test-10-postgresql-0  0/1    Init:0/1  0         2s

==> v1/Secret
NAME                     TYPE    DATA  AGE
psql-test-10-postgresql  Opaque  1     2s

==> v1/Service
NAME                              TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
psql-test-10-postgresql           ClusterIP  100.70.109.222  <none>       5432/TCP  2s
psql-test-10-postgresql-headless  ClusterIP  None            <none>       5432/TCP  2s

==> v1beta2/StatefulSet
NAME                     READY  AGE
psql-test-10-postgresql  0/1    2s


NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    psql-test-10-postgresql.default.svc.cluster.local - Read/Write connection
To get the password for "mydb" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-10-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run psql-test-10-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.3.0-debian-9-r38 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host psql-test-10-postgresql -U mydb -d mydb -p 5432



To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-10-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U mydb -d mydb -p 5432

++ sleep 60
+++ seq 1 10
++ for i in '`seq 1 10`'
++ kubectl exec psql-test-1-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-2-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-3-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-4-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-5-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
psql: FATAL:  database "mydb" does not exist
command terminated with exit code 2
++ for i in '`seq 1 10`'
++ kubectl exec psql-test-6-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
psql: FATAL:  database "mydb" does not exist
command terminated with exit code 2
++ for i in '`seq 1 10`'
++ kubectl exec psql-test-7-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
psql: FATAL:  database "mydb" does not exist
command terminated with exit code 2
++ for i in '`seq 1 10`'
++ kubectl exec psql-test-8-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-9-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 mydb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | mydb=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

++ for i in '`seq 1 10`'
++ kubectl exec psql-test-10-postgresql-0 -- sh -c 'export PGPASSWORD=mydb; psql -U mydb -d mydb -p 5432 -l'
psql: FATAL:  database "mydb" does not exist
command terminated with exit code 2
+++ seq 1 10
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-1-postgresql-0
 11:38:45.51 
 11:38:45.51 Welcome to the Bitnami postgresql container
 11:38:45.51 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:38:45.51 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:38:45.52 Send us your feedback at [email protected]
 11:38:45.52 
 11:38:45.56 INFO  ==> ** Starting PostgreSQL setup **
 11:38:45.63 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:38:45.63 INFO  ==> Initializing PostgreSQL database...
 11:38:45.64 INFO  ==> postgresql.conf file not detected. Generating it...
 11:38:45.64 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:38:45.65 INFO  ==> Deploying PostgreSQL with persisted data...
 11:38:45.65 INFO  ==> Configuring replication parameters
 11:38:45.67 INFO  ==> Configuring fsync
 11:38:45.67 INFO  ==> Loading custom scripts...
 11:38:45.68 INFO  ==> Enabling remote connections
 11:38:45.68 INFO  ==> Stopping PostgreSQL...
 11:38:45.69 INFO  ==> ** PostgreSQL setup finished! **

 11:38:45.76 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:38:45.784 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:38:45.784 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:38:45.789 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:38:45.800 GMT [181] LOG:  database system was shut down at 2019-06-13 11:35:51 GMT
2019-06-13 11:38:45.808 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-2-postgresql-0
 11:38:42.52 
 11:38:42.52 Welcome to the Bitnami postgresql container
 11:38:42.52 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:38:42.52 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:38:42.53 Send us your feedback at [email protected]
 11:38:42.53 
 11:38:42.58 INFO  ==> ** Starting PostgreSQL setup **
 11:38:42.66 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:38:42.66 INFO  ==> Initializing PostgreSQL database...
 11:38:42.68 INFO  ==> postgresql.conf file not detected. Generating it...
 11:38:42.69 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:38:42.70 INFO  ==> Deploying PostgreSQL with persisted data...
 11:38:42.70 INFO  ==> Configuring replication parameters
 11:38:42.72 INFO  ==> Configuring fsync
 11:38:42.72 INFO  ==> Loading custom scripts...
 11:38:42.74 INFO  ==> Enabling remote connections
 11:38:42.75 INFO  ==> Stopping PostgreSQL...
 11:38:42.75 INFO  ==> ** PostgreSQL setup finished! **

 11:38:42.84 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:38:42.992 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:38:42.992 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:38:42.999 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:38:43.020 GMT [181] LOG:  database system was shut down at 2019-06-13 11:35:55 GMT
2019-06-13 11:38:43.042 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-3-postgresql-0
 11:38:55.58 
 11:38:55.58 Welcome to the Bitnami postgresql container
 11:38:55.58 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:38:55.58 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:38:55.58 Send us your feedback at [email protected]
 11:38:55.58 
 11:38:55.62 INFO  ==> ** Starting PostgreSQL setup **
 11:38:55.69 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:38:55.70 INFO  ==> Initializing PostgreSQL database...
 11:38:55.70 INFO  ==> postgresql.conf file not detected. Generating it...
 11:38:55.71 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:38:55.72 INFO  ==> Deploying PostgreSQL with persisted data...
 11:38:55.72 INFO  ==> Configuring replication parameters
 11:38:55.73 INFO  ==> Configuring fsync
 11:38:55.74 INFO  ==> Loading custom scripts...
 11:38:55.74 INFO  ==> Enabling remote connections
 11:38:55.75 INFO  ==> Stopping PostgreSQL...
 11:38:55.75 INFO  ==> ** PostgreSQL setup finished! **

 11:38:55.82 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:38:55.853 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:38:55.853 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:38:55.863 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:38:55.875 GMT [181] LOG:  database system was shut down at 2019-06-13 11:35:59 GMT
2019-06-13 11:38:55.881 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-4-postgresql-0
 11:38:51.55 
 11:38:51.55 Welcome to the Bitnami postgresql container
 11:38:51.55 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:38:51.55 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:38:51.55 Send us your feedback at [email protected]
 11:38:51.55 
 11:38:51.60 INFO  ==> ** Starting PostgreSQL setup **
 11:38:51.70 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:38:51.71 INFO  ==> Initializing PostgreSQL database...
 11:38:51.71 INFO  ==> postgresql.conf file not detected. Generating it...
 11:38:51.72 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:38:51.73 INFO  ==> Deploying PostgreSQL with persisted data...
 11:38:51.73 INFO  ==> Configuring replication parameters
 11:38:51.75 INFO  ==> Configuring fsync
 11:38:51.76 INFO  ==> Loading custom scripts...
 11:38:51.76 INFO  ==> Enabling remote connections
 11:38:51.77 INFO  ==> Stopping PostgreSQL...
 11:38:51.77 INFO  ==> ** PostgreSQL setup finished! **

 11:38:51.85 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:38:51.883 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:38:51.883 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:38:51.889 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:38:51.901 GMT [182] LOG:  database system was shut down at 2019-06-13 11:36:02 GMT
2019-06-13 11:38:51.911 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-5-postgresql-0
 11:39:09.58 
 11:39:09.59 Welcome to the Bitnami postgresql container
 11:39:09.59 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:09.59 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:09.59 Send us your feedback at [email protected]
 11:39:09.59 
 11:39:09.65 INFO  ==> ** Starting PostgreSQL setup **
 11:39:09.75 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:09.75 INFO  ==> Initializing PostgreSQL database...
 11:39:09.76 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:09.78 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:09.78 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:09.79 INFO  ==> Configuring replication parameters
 11:39:09.84 INFO  ==> Configuring fsync
 11:39:09.86 INFO  ==> Loading custom scripts...
 11:39:09.87 INFO  ==> Enabling remote connections
 11:39:09.89 INFO  ==> Stopping PostgreSQL...
 11:39:09.90 INFO  ==> ** PostgreSQL setup finished! **

 11:39:10.04 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:10.069 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:10.069 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:10.163 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:10.179 GMT [180] LOG:  database system was shut down at 2019-06-13 11:36:04 GMT
2019-06-13 11:39:10.185 GMT [1] LOG:  database system is ready to accept connections
2019-06-13 11:40:24.334 GMT [279] FATAL:  database "mydb" does not exist
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-6-postgresql-0
 11:39:13.41 
 11:39:13.41 Welcome to the Bitnami postgresql container
 11:39:13.41 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:13.41 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:13.41 Send us your feedback at [email protected]
 11:39:13.41 
 11:39:13.45 INFO  ==> ** Starting PostgreSQL setup **
 11:39:13.52 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:13.53 INFO  ==> Initializing PostgreSQL database...
 11:39:13.53 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:13.54 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:13.55 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:13.55 INFO  ==> Configuring replication parameters
 11:39:13.56 INFO  ==> Configuring fsync
 11:39:13.57 INFO  ==> Loading custom scripts...
 11:39:13.57 INFO  ==> Enabling remote connections
 11:39:13.58 INFO  ==> Stopping PostgreSQL...
 11:39:13.58 INFO  ==> ** PostgreSQL setup finished! **

 11:39:13.66 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:13.699 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:13.699 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:13.704 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:13.716 GMT [180] LOG:  database system was shut down at 2019-06-13 11:36:07 GMT
2019-06-13 11:39:13.723 GMT [1] LOG:  database system is ready to accept connections
2019-06-13 11:40:25.642 GMT [271] FATAL:  database "mydb" does not exist
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-7-postgresql-0
 11:39:10.74 
 11:39:10.74 Welcome to the Bitnami postgresql container
 11:39:10.74 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:10.75 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:10.75 Send us your feedback at [email protected]
 11:39:10.75 
 11:39:10.79 INFO  ==> ** Starting PostgreSQL setup **
 11:39:10.87 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:10.87 INFO  ==> Initializing PostgreSQL database...
 11:39:10.88 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:10.88 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:10.89 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:10.89 INFO  ==> Configuring replication parameters
 11:39:10.91 INFO  ==> Configuring fsync
 11:39:10.91 INFO  ==> Loading custom scripts...
 11:39:10.92 INFO  ==> Enabling remote connections
 11:39:10.92 INFO  ==> Stopping PostgreSQL...
 11:39:10.93 INFO  ==> ** PostgreSQL setup finished! **

 11:39:11.00 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:11.027 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:11.027 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:11.032 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:11.042 GMT [179] LOG:  database system was shut down at 2019-06-13 11:36:10 GMT
2019-06-13 11:39:11.048 GMT [1] LOG:  database system is ready to accept connections
2019-06-13 11:40:27.433 GMT [284] FATAL:  database "mydb" does not exist
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-8-postgresql-0
 11:39:11.14 
 11:39:11.15 Welcome to the Bitnami postgresql container
 11:39:11.15 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:11.15 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:11.15 Send us your feedback at [email protected]
 11:39:11.15 
 11:39:11.19 INFO  ==> ** Starting PostgreSQL setup **
 11:39:11.26 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:11.26 INFO  ==> Initializing PostgreSQL database...
 11:39:11.27 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:11.28 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:11.28 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:11.29 INFO  ==> Configuring replication parameters
 11:39:11.30 INFO  ==> Configuring fsync
 11:39:11.31 INFO  ==> Loading custom scripts...
 11:39:11.31 INFO  ==> Enabling remote connections
 11:39:11.32 INFO  ==> Stopping PostgreSQL...
 11:39:11.32 INFO  ==> ** PostgreSQL setup finished! **

 11:39:11.39 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:11.417 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:11.417 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:11.421 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:11.431 GMT [181] LOG:  database system was shut down at 2019-06-13 11:36:13 GMT
2019-06-13 11:39:11.436 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-9-postgresql-0
 11:39:20.78 
 11:39:20.79 Welcome to the Bitnami postgresql container
 11:39:20.79 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:20.79 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:20.79 Send us your feedback at [email protected]
 11:39:20.79 
 11:39:20.83 INFO  ==> ** Starting PostgreSQL setup **
 11:39:20.90 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:20.91 INFO  ==> Initializing PostgreSQL database...
 11:39:20.92 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:20.92 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:20.93 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:20.93 INFO  ==> Configuring replication parameters
 11:39:20.95 INFO  ==> Configuring fsync
 11:39:20.95 INFO  ==> Loading custom scripts...
 11:39:20.95 INFO  ==> Enabling remote connections
 11:39:20.96 INFO  ==> Stopping PostgreSQL...
 11:39:20.97 INFO  ==> ** PostgreSQL setup finished! **

 11:39:21.04 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:21.064 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:21.064 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:21.069 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:21.079 GMT [181] LOG:  database system was shut down at 2019-06-13 11:36:16 GMT
2019-06-13 11:39:21.084 GMT [1] LOG:  database system is ready to accept connections
++ for i in '`seq 1 10`'
++ kubectl logs psql-test-10-postgresql-0
 11:39:35.12 
 11:39:35.12 Welcome to the Bitnami postgresql container
 11:39:35.12 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 11:39:35.12 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 11:39:35.12 Send us your feedback at [email protected]
 11:39:35.12 
 11:39:35.16 INFO  ==> ** Starting PostgreSQL setup **
 11:39:35.23 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 11:39:35.23 INFO  ==> Initializing PostgreSQL database...
 11:39:35.24 INFO  ==> postgresql.conf file not detected. Generating it...
 11:39:35.25 INFO  ==> pg_hba.conf file not detected. Generating it...
 11:39:35.25 INFO  ==> Deploying PostgreSQL with persisted data...
 11:39:35.26 INFO  ==> Configuring replication parameters
 11:39:35.27 INFO  ==> Configuring fsync
 11:39:35.28 INFO  ==> Loading custom scripts...
 11:39:35.28 INFO  ==> Enabling remote connections
 11:39:35.28 INFO  ==> Stopping PostgreSQL...
 11:39:35.29 INFO  ==> ** PostgreSQL setup finished! **

 11:39:35.36 INFO  ==> ** Starting PostgreSQL **
2019-06-13 11:39:35.387 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-13 11:39:35.387 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-13 11:39:35.394 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-13 11:39:35.404 GMT [181] LOG:  database system was shut down at 2019-06-13 11:36:18 GMT
2019-06-13 11:39:35.410 GMT [1] LOG:  database system is ready to accept connections
2019-06-13 11:40:31.606 GMT [258] FATAL:  database "mydb" does not exist
+++ seq 1 10
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-1
release "psql-test-1" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-2
release "psql-test-2" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-3
release "psql-test-3" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-4
release "psql-test-4" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-5
release "psql-test-5" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-6
release "psql-test-6" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-7
release "psql-test-7" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-8
release "psql-test-8" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-9
release "psql-test-9" deleted
++ for i in '`seq 1 10`'
++ helm del --purge psql-test-10
release "psql-test-10" deleted

So looks like the issue is not related to PostgreSQL version or to chart version or to values.yaml.

What else can it be?

@POD666
Copy link
Author

POD666 commented Jun 14, 2019

I assumed that there might be a delay before env variables are set, so I added the following command here:

...
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
command: 
          - sh
          - -c
          - |
            echo "POSTGRES_DB: $POSTGRES_DB" 
            sleep 10
            echo "POSTGRES_DB: $POSTGRES_DB" 
            sleep 20
            echo "POSTGRES_DB: $POSTGRES_DB" 
            /entrypoint.sh /run.sh
resources:
...

1 of 10 delpoyments failed with the following output:

$ kubectl logs psqltest-5-postgresql-0
POSTGRES_DB: mydb
POSTGRES_DB: mydb
POSTGRES_DB: mydb
 13:57:42.74 
 13:57:42.74 Welcome to the Bitnami postgresql container
 13:57:42.74 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 13:57:42.74 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 13:57:42.75 Send us your feedback at [email protected]
 13:57:42.75 
 13:57:42.78 INFO  ==> ** Starting PostgreSQL setup **
 13:57:42.85 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 13:57:42.85 INFO  ==> Initializing PostgreSQL database...
 13:57:42.86 INFO  ==> postgresql.conf file not detected. Generating it...
 13:57:42.86 INFO  ==> pg_hba.conf file not detected. Generating it...
 13:57:44.03 INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
 13:57:44.14 INFO  ==> Creating user mydb
 13:57:44.16 INFO  ==> Grating access to "mydb" to the database "postgres"
 13:57:44.18 INFO  ==> Configuring replication parameters
 13:57:44.20 INFO  ==> Configuring fsync
 13:57:44.20 INFO  ==> Loading custom scripts...
 13:57:44.20 INFO  ==> Enabling remote connections
 13:57:44.21 INFO  ==> Stopping PostgreSQL...
 13:57:45.22 INFO  ==> ** PostgreSQL setup finished! **

 13:57:45.28 INFO  ==> ** Starting PostgreSQL **
2019-06-14 13:57:45.303 GMT [30] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-14 13:57:45.303 GMT [30] LOG:  listening on IPv6 address "::", port 5432
2019-06-14 13:57:45.306 GMT [30] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-14 13:57:45.315 GMT [247] LOG:  database system was shut down at 2019-06-14 13:57:44 GMT
2019-06-14 13:57:45.318 GMT [30] LOG:  database system is ready to accept connections
2019-06-14 13:59:06.134 GMT [382] FATAL:  database "mydb" does not exist

So looks like postgresql might ignore POSTGRES_DB for some reason.

@POD666
Copy link
Author

POD666 commented Jun 14, 2019

After looking at this, decided to also check POSTGRESQL_DATABASE:

command: 
          - sh
          - -c
          - |
            echo "POSTGRES_DB: $POSTGRES_DB" 
            echo "POSTGRESQL_DATABASE: $POSTGRESQL_DATABASE" 
            sleep 5
            echo "POSTGRES_DB: $POSTGRES_DB" 
            echo "POSTGRESQL_DATABASE: $POSTGRESQL_DATABASE" 
            /entrypoint.sh /run.sh

Output:

$ kubectl logs psqltest-3-postgresql-0
POSTGRES_DB: mydb
POSTGRESQL_DATABASE: 
POSTGRES_DB: mydb
POSTGRESQL_DATABASE: 
 14:53:58.94 
 14:53:58.94 Welcome to the Bitnami postgresql container
 14:53:58.94 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 14:53:58.95 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 14:53:58.95 Send us your feedback at [email protected]
 14:53:58.95 
 14:53:58.98 INFO  ==> ** Starting PostgreSQL setup **
 14:53:59.06 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 14:53:59.06 INFO  ==> Initializing PostgreSQL database...
 14:53:59.07 INFO  ==> postgresql.conf file not detected. Generating it...
 14:53:59.07 INFO  ==> pg_hba.conf file not detected. Generating it...
 14:54:00.26 INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
 14:54:00.38 INFO  ==> Creating user mydb
 14:54:00.41 INFO  ==> Grating access to "mydb" to the database "postgres"
 14:54:00.44 INFO  ==> Configuring replication parameters
 14:54:00.46 INFO  ==> Configuring fsync
 14:54:00.46 INFO  ==> Loading custom scripts...
 14:54:00.47 INFO  ==> Enabling remote connections
 14:54:00.48 INFO  ==> Stopping PostgreSQL...
 14:54:01.49 INFO  ==> ** PostgreSQL setup finished! **

 14:54:01.56 INFO  ==> ** Starting PostgreSQL **
2019-06-14 14:54:01.584 GMT [7] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-14 14:54:01.584 GMT [7] LOG:  listening on IPv6 address "::", port 5432
2019-06-14 14:54:01.591 GMT [7] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-14 14:54:01.601 GMT [223] LOG:  database system was shut down at 2019-06-14 14:54:00 GMT
2019-06-14 14:54:01.606 GMT [7] LOG:  database system is ready to accept connections
2019-06-14 14:55:26.167 GMT [351] FATAL:  database "mydb" does not exist


$ kubectl logs psqltest-2-postgresql-0
POSTGRES_DB: mydb
POSTGRESQL_DATABASE: 
POSTGRES_DB: mydb
POSTGRESQL_DATABASE: 
 14:54:02.98 
 14:54:02.98 Welcome to the Bitnami postgresql container
 14:54:02.98 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 14:54:02.98 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 14:54:02.98 Send us your feedback at [email protected]
 14:54:02.98 
 14:54:03.02 INFO  ==> ** Starting PostgreSQL setup **
 14:54:03.09 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 14:54:03.09 INFO  ==> Initializing PostgreSQL database...
 14:54:03.10 INFO  ==> postgresql.conf file not detected. Generating it...
 14:54:03.11 INFO  ==> pg_hba.conf file not detected. Generating it...
 14:54:04.41 INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
 14:54:04.79 INFO  ==> Creating user mydb
 14:54:04.80 INFO  ==> Grating access to "mydb" to the database "mydb"
 14:54:04.83 INFO  ==> Configuring replication parameters
 14:54:04.84 INFO  ==> Configuring fsync
 14:54:04.85 INFO  ==> Loading custom scripts...
 14:54:04.85 INFO  ==> Enabling remote connections
 14:54:04.86 INFO  ==> Stopping PostgreSQL...
 14:54:05.86 INFO  ==> ** PostgreSQL setup finished! **

 14:54:05.94 INFO  ==> ** Starting PostgreSQL **
2019-06-14 14:54:05.961 GMT [7] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-14 14:54:05.961 GMT [7] LOG:  listening on IPv6 address "::", port 5432
2019-06-14 14:54:05.965 GMT [7] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-14 14:54:05.975 GMT [229] LOG:  database system was shut down at 2019-06-14 14:54:04 GMT
2019-06-14 14:54:05.979 GMT [7] LOG:  database system is ready to accept connections

@POD666
Copy link
Author

POD666 commented Jun 14, 2019

I'm not longer able to reproduce the issue (10/10 + 50/50) after changing command to:

command: 
          - bash
          - -c
          - |
            echo "POSTGRES_DB: $POSTGRES_DB" 
            echo "POSTGRESQL_DATABASE: $POSTGRESQL_DATABASE" 
            . /libpostgresql.sh
            eval "$(postgresql_env)"
            echo "POSTGRES_DB: $POSTGRES_DB" 
            echo "POSTGRESQL_DATABASE: $POSTGRESQL_DATABASE" 
            /entrypoint.sh /run.sh

Output:

POSTGRES_DB: mydb
POSTGRESQL_DATABASE: 
POSTGRES_DB: mydb
POSTGRESQL_DATABASE: mydb
 15:15:12.73 
 15:15:12.74 Welcome to the Bitnami postgresql container
 15:15:12.74 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
 15:15:12.74 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 15:15:12.74 Send us your feedback at [email protected]
 15:15:12.74 
 15:15:12.78 INFO  ==> ** Starting PostgreSQL setup **
 15:15:12.85 INFO  ==> Validating settings in POSTGRESQL_* env vars..
 15:15:12.85 INFO  ==> Initializing PostgreSQL database...
 15:15:12.86 INFO  ==> postgresql.conf file not detected. Generating it...
 15:15:12.87 INFO  ==> pg_hba.conf file not detected. Generating it...
 15:15:14.06 INFO  ==> Starting PostgreSQL in background...
/tmp:5432 - accepting connections
 15:15:14.43 INFO  ==> Creating user mydb
 15:15:14.44 INFO  ==> Grating access to "mydb" to the database "mydb"
 15:15:14.46 INFO  ==> Configuring replication parameters
 15:15:14.48 INFO  ==> Configuring fsync
 15:15:14.48 INFO  ==> Loading custom scripts...
 15:15:14.49 INFO  ==> Enabling remote connections
 15:15:14.49 INFO  ==> Stopping PostgreSQL...
 15:15:15.50 INFO  ==> ** PostgreSQL setup finished! **

 15:15:15.57 INFO  ==> ** Starting PostgreSQL **
2019-06-14 15:15:15.592 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-06-14 15:15:15.592 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2019-06-14 15:15:15.596 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-06-14 15:15:15.605 GMT [265] LOG:  database system was shut down at 2019-06-14 15:15:14 GMT
2019-06-14 15:15:15.610 GMT [1] LOG:  database system is ready to accept connections

@POD666
Copy link
Author

POD666 commented Jun 14, 2019

Should I move the issue to bitnami/bitnami-docker-postgresql?

@tompizmor
Copy link
Collaborator

Yes please @POD666!

Thanks a lot for digging into that. However, I am still surprised that I couldn't reproduce the issue.

@POD666
Copy link
Author

POD666 commented Jun 20, 2019

The issue moved to bitnami/bitnami-docker-postgresql:
https://github.com/bitnami/bitnami-docker-postgresql/issues/152

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants