update db connection part in user docs
This commit is contained in:
		
							parent
							
								
									313db7d10b
								
							
						
					
					
						commit
						1a0adda9ed
					
				
							
								
								
									
										20
									
								
								docs/user.md
								
								
								
								
							
							
						
						
									
										20
									
								
								docs/user.md
								
								
								
								
							|  | @ -43,13 +43,25 @@ $ kubectl get pods -w --show-labels | ||||||
| 
 | 
 | ||||||
| ## Connect to PostgreSQL | ## Connect to PostgreSQL | ||||||
| 
 | 
 | ||||||
| We can use the generated secret of the `postgres` robot user to connect to our `acid-minimal-cluster` master running in Minikube: | With a `port-forward` on one of the database pods (e.g. the master) you can | ||||||
|  | connect to the PostgreSQL database. Use labels to filter for the master pod of | ||||||
|  | our test cluster. | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | # get name of master pod of acid-minimal-cluster | ||||||
|  | export PGMASTER=$(kubectl get pods -o jsonpath={.items..metadata.name} -l application=spilo,version=acid-minimal-cluster,spilo-role=master) | ||||||
|  | 
 | ||||||
|  | # set up port forward | ||||||
|  | kubectl port-forward $PGMASTER 6432:5432 | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Open another CLI and connect to the database. Use the generated secret of the | ||||||
|  | `postgres` robot user to connect to our `acid-minimal-cluster` master running | ||||||
|  | in Minikube: | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ export PGHOST=db_host |  | ||||||
| $ export PGPORT=db_port |  | ||||||
| $ export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}' | base64 -d) | $ export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}' | base64 -d) | ||||||
| $ psql -U postgres | $ psql -U postgres -p 6432 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| # Defining database roles in the operator | # Defining database roles in the operator | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue