Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 3b443c9

Browse files
Updated Readmes with instructions for cloud shell users
1 parent a351bcd commit 3b443c9

File tree

2 files changed

+79
-7
lines changed

2 files changed

+79
-7
lines changed

README-QWIKLABS.md

+36-7
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,40 @@ container and creates the credentials file
172172
containing credentials and connection string for the Cloud SQL instance
173173
6. pgadmin_deployment.sh - creates the pgAdmin4 pod
174174

175-
Once **create.sh** is complete you need to run ```make expose``` to connect to
176-
the running pgAdmin pod. ```make expose``` will port-forward to the running pod.
177-
You can [connect to the port-forwarded pgAdmin in your
178-
browser](http://127.0.0.1:8080/login). Use the ```<PGADMIN_USERNAME>``` in the "Email
179-
Address" field and ```<PG_ADMIN_CONSOLE_PASSWORD>``` you defined earlier to login to the console.
180-
From there you can click "Add New Server" and use the ```<DATABASE_USER_NAME>``` and
181-
```<USER_PASSWORD>``` you created earlier to connect to 127.0.0.1:5432.
175+
176+
If you're running the demo within a cloud shell or any web apps using iframes,
177+
note that port-forwarding might not work.
178+
179+
Hence, we need to use load balancer to expose the pod to connect to the instance.
180+
We also need to delete the services in the end to avoid unauthorized access.
181+
182+
On the cloud shell:
183+
Get the Pod ID:
184+
POD_ID=$(kubectl --namespace default get pods -o name | cut -d '/' -f 2)
185+
186+
Expose the pod via load balancer:
187+
kubectl expose pod $POD_ID --port=80 --type=LoadBalancer
188+
189+
Get the service IP address:
190+
kubectl get svc
191+
192+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
193+
kubernetes ClusterIP <CLUSTER_IP> <none> 443/TCP 96m
194+
pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer <CLUSTER_IP> <SVC_IP> 80:31789/TCP 45m
195+
196+
You can connect to the pgAdmin in your browser, using <SVC_IP>.
197+
198+
http://<SVC_IP>
199+
200+
Use the <PGADMIN_USERNAME> in the "Email Address" field and <PG_ADMIN_CONSOLE_PASSWORD> you defined earlier to login to the console. From there you can click "Add New Server" and use the <DATABASE_USER_NAME> and <USER_PASSWORD> you created earlier to connect to 127.0.0.1:5432.
201+
202+
After successful connection, delete the services to avoid unauthorized access:
203+
204+
On the cloud shell, run:
205+
206+
kubectl delete svc <SVC_NAME>
207+
208+
182209

183210
## Validation
184211

@@ -201,6 +228,8 @@ pgAdmin4 Deployment object exists
201228

202229
## Teardown
203230

231+
Before tearing down the environment, we need to delete the load balancer services created, in order to
232+
204233
Teardown is fully automated. The teardown script deletes every resource created
205234
in the deployment script. In order to teardown you need to run,
206235

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,49 @@ container and creates the credentials file
177177
containing credentials and connection string for the Cloud SQL instance
178178
6. pgadmin_deployment.sh - creates the pgAdmin4 pod
179179

180+
181+
Once **create.sh** is complete you need to expose the pod to connect to
182+
the running pgAdmin instance. Depending on whether you're running the demo on
183+
Cloud shell or not, follow the below steps:
184+
185+
186+
### Cloud Shell Users
187+
188+
If you're running the demo within a cloud shell or any web apps using iframes,
189+
note that port-forwarding might not work.
190+
191+
Hence, we need to use load balancer to expose the pod to connect to the instance.
192+
We also need to delete the services in the end to avoid unauthorized access.
193+
194+
On the cloud shell:
195+
Get the Pod ID:
196+
POD_ID=$(kubectl --namespace default get pods -o name | cut -d '/' -f 2)
197+
198+
Expose the pod via load balancer:
199+
kubectl expose pod $POD_ID --port=80 --type=LoadBalancer
200+
201+
Get the service IP address:
202+
kubectl get svc
203+
204+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
205+
kubernetes ClusterIP <CLUSTER_IP> <none> 443/TCP 96m
206+
pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer <CLUSTER_IP> <SVC_IP> 80:31789/TCP 45m
207+
208+
You can connect to the pgAdmin in your browser, using <SVC_IP>.
209+
210+
http://<SVC_IP>
211+
212+
Use the <PGADMIN_USERNAME> in the "Email Address" field and <PG_ADMIN_CONSOLE_PASSWORD> you defined earlier to login to the console. From there you can click "Add New Server" and use the <DATABASE_USER_NAME> and <USER_PASSWORD> you created earlier to connect to 127.0.0.1:5432.
213+
214+
After successful connection, delete the services to avoid unauthorized access:
215+
216+
On the cloud shell, run:
217+
218+
kubectl delete svc <SVC_NAME>
219+
220+
221+
### Cloud SDK users (or non cloud shell users)
222+
180223
Once **create.sh** is complete you need to run ```make expose``` to connect to
181224
the running pgAdmin pod. ```make expose``` will port-forward to the running pod.
182225
You can [connect to the port-forwarded pgAdmin in your

0 commit comments

Comments
 (0)