Bug 1270434

Summary: Cannot login to postgresql-94-rhel7 after creating postgresql with postgresql-persistent-template.json
Product: Red Hat Software Collections Reporter: wewang <wewang>
Component: rh-postgresql94-containerAssignee: Pavel Raiskup <praiskup>
Status: CLOSED NOTABUG QA Contact: wewang <wewang>
Severity: medium Docs Contact:
Priority: medium    
Version: rh-postgresql94CC: aos-bugs, bparees, eslobodo, hhorak, jokerman, jorton, kanderso, mmccomas, wewang
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-27 15:32:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1220712    

Description wewang 2015-10-10 04:56:08 UTC
Version-Release number of selected component (if applicable):
openshift v3.0.2.0-17-g701346b
kubernetes v1.1.0-alpha.0-1605-g44c91b1
rhscl/postgresql-94-rhel7      image-id:20a1960468dc

Description of problem:
Cannot login to  postgresql-94-rhel7 after creating postgresql with postgresql-persistent-template.json
How reproducible:
Always

Steps to Reproduce:
1. Setup nfs server
2. Create pv on master
3. Create a project
4. Create postgresql imagestream
5. create postgresql with postgresql-persistent-template.json(Note: change the imagestream namespace and name to your own project  in template)
$ oc process -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/postgresql-persistent-template.json | oc create -f -

6.  Check the start-up pod status
# oc get pods
NAME                 READY     STATUS    RESTARTS   AGE
postgresql-1-i66gv   1/1       Running   0          1m
# oc get pvc
NAME         LABELS                                         STATUS    VOLUME    AGE
postgresql   map[template:postgresql-persistent-template]   Bound     wangpv6   16m

7. Check db account
# oc env pod postgresql-1-i66gv --list
# pods postgresql-1-i66gv, container postgresql
POSTGRESQL_USER=userL7X
POSTGRESQL_PASSWORD=Qh7x3CY8WFyInC6Y
POSTGRESQL_DATABASE=sampledb

8. Access into postgresql pod and write some data
[root@dhcp-128-91 V3]# oc rsh postgresql-1-i66gv
bash-4.2$ psql -h postgresql-1-i66gv -U userL7X -d sampledb
psql: could not connect to server: Connection refused
    Is the server running on host "postgresql-1-i66gv" (10.1.1.162) and accepting
    TCP/IP connections on port 5432?

9.[root@dhcp-128-91 V3]# oc describe pod postgresql-1-i66gv
Name:                postgresql-1-i66gv
Namespace:            project6
Image(s):            registry.access.redhat.com/rhscl_beta/postgresql-94-rhel7:latest
Node:                openshift-137.lab.sjc.redhat.com/10.14.6.137
Labels:                deployment=postgresql-1,deploymentconfig=postgresql,name=postgresql
Status:                Running
Reason:                
Message:            
IP:                10.1.1.162
Replication Controllers:    postgresql-1 (1/1 replicas created)
Containers:
  postgresql:
    Image:        registry.access.redhat.com/rhscl_beta/postgresql-94-rhel7:latest
    State:        Running
      Started:        Sat, 10 Oct 2015 10:32:33 +0800
    Ready:        True
    Restart Count:    0
    Variables:
      POSTGRESQL_USER:        userL7X
      POSTGRESQL_PASSWORD:    Qh7x3CY8WFyInC6Y
      POSTGRESQL_DATABASE:    sampledb


Actual results:
8. Cannot login to postgresql successfully 


Expected results:
Connect to postgresql successfully 

-------------------------------------
Additional info:
Login to postgresql successfully  when creating postgresql with postgresql-ephemeral-template.json

Comment 2 Pavel Raiskup 2015-10-10 11:20:05 UTC
Sorry, I can't reproduce.  I'm able to connect to postgresql server
both from host and from image itself:

  $ docker run --rm -ti -e POSTGRESQL_USER=userL7X -e POSTGRESQL_PASSWORD=Qh7x3CY8WFyInC6Y -e POSTGRESQL_DATABASE=sampledb rcm-img-docker01.build.eng.bos.redhat.com:5001/rhscl/postgresql-94-rhel7:latest
  $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' `docker ps -q`
  172.17.03
  $ psql -h 172.17.03 -U userL7X -d sampledb
  Password for user userL7X: 
  psql (9.4.4)
  Type "help" for help.

sampledb=>

  The same from container itself:
  $ docker exec -ti `docker ps -q` bash
  bash-4.2$ psql
  psql (9.4.4)
  Type "help" for help.
  
  postgres=#

Comment 3 Pavel Raiskup 2015-10-21 13:10:02 UTC
Ping, any news here, wewang?

Comment 4 Pavel Raiskup 2015-10-21 13:20:34 UTC
I've been told that this is blocker for OpenShift and that Ben could possibly
help here.  Do we have self-standing reproducer?

Comment 5 Ben Parees 2015-10-21 14:20:32 UTC
wewang, can you confirm that the mounted storage in the container (/var/lib/pgsql/data) is writable?  Is there any other interesting information in the pod logs?

Comment 6 Ben Parees 2015-10-21 15:50:50 UTC
I was able to run this successfully using a a non-NFS persistent volume (i followed this instead to create a persistent volume: https://github.com/openshift/postgresql/tree/master/examples/replica#deployment)

so i think the issue here is likely a permissions one, though i'm surprised the pod started at all if the permissions aren't correct.

wewang, please retest using the latest image and check if there is a permissions problem with the mounted storage.

Comment 7 wewang 2015-10-22 12:05:04 UTC
I will verify it tomorrow in ose, pls wait,thx

Comment 8 Pavel Raiskup 2015-10-23 09:47:14 UTC
(In reply to wewang from comment #7)
> I will verify it tomorrow in ose, pls wait,thx

Thanks!  Re-adding the needinfo back then.

Comment 10 wewang 2015-10-27 01:53:07 UTC
verified in ose_3.1
openshift v3.0.2.902
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4
etcd 2.1.2

Comment 11 Pavel Raiskup 2015-10-27 08:47:10 UTC
Isn't this rather notabug?  Or bad component (rh-postgresql94-docker)?
Because I'm not aware of any bug I fixed ... which could be VERIFIED.