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

Commit

Permalink
Updated Readmes with instructions for cloud shell users
Browse files Browse the repository at this point in the history
  • Loading branch information
swathiswaminathan committed Jul 16, 2019
1 parent a351bcd commit 3b443c9
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 7 deletions.
43 changes: 36 additions & 7 deletions README-QWIKLABS.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,40 @@ container and creates the credentials file
containing credentials and connection string for the Cloud SQL instance
6. pgadmin_deployment.sh - creates the pgAdmin4 pod

Once **create.sh** is complete you need to run ```make expose``` to connect to
the running pgAdmin pod. ```make expose``` will port-forward to the running pod.
You can [connect to the port-forwarded pgAdmin in your
browser](http://127.0.0.1:8080/login). 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.

If you're running the demo within a cloud shell or any web apps using iframes,
note that port-forwarding might not work.

Hence, we need to use load balancer to expose the pod to connect to the instance.
We also need to delete the services in the end to avoid unauthorized access.

On the cloud shell:
Get the Pod ID:
POD_ID=$(kubectl --namespace default get pods -o name | cut -d '/' -f 2)

Expose the pod via load balancer:
kubectl expose pod $POD_ID --port=80 --type=LoadBalancer

Get the service IP address:
kubectl get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP <CLUSTER_IP> <none> 443/TCP 96m
pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer <CLUSTER_IP> <SVC_IP> 80:31789/TCP 45m

You can connect to the pgAdmin in your browser, using <SVC_IP>.

http://<SVC_IP>

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.

After successful connection, delete the services to avoid unauthorized access:

On the cloud shell, run:

kubectl delete svc <SVC_NAME>



## Validation

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

## Teardown

Before tearing down the environment, we need to delete the load balancer services created, in order to

Teardown is fully automated. The teardown script deletes every resource created
in the deployment script. In order to teardown you need to run,

Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,49 @@ container and creates the credentials file
containing credentials and connection string for the Cloud SQL instance
6. pgadmin_deployment.sh - creates the pgAdmin4 pod


Once **create.sh** is complete you need to expose the pod to connect to
the running pgAdmin instance. Depending on whether you're running the demo on
Cloud shell or not, follow the below steps:


### Cloud Shell Users

If you're running the demo within a cloud shell or any web apps using iframes,
note that port-forwarding might not work.

Hence, we need to use load balancer to expose the pod to connect to the instance.
We also need to delete the services in the end to avoid unauthorized access.

On the cloud shell:
Get the Pod ID:
POD_ID=$(kubectl --namespace default get pods -o name | cut -d '/' -f 2)

Expose the pod via load balancer:
kubectl expose pod $POD_ID --port=80 --type=LoadBalancer

Get the service IP address:
kubectl get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP <CLUSTER_IP> <none> 443/TCP 96m
pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer <CLUSTER_IP> <SVC_IP> 80:31789/TCP 45m

You can connect to the pgAdmin in your browser, using <SVC_IP>.

http://<SVC_IP>

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.

After successful connection, delete the services to avoid unauthorized access:

On the cloud shell, run:

kubectl delete svc <SVC_NAME>


### Cloud SDK users (or non cloud shell users)

Once **create.sh** is complete you need to run ```make expose``` to connect to
the running pgAdmin pod. ```make expose``` will port-forward to the running pod.
You can [connect to the port-forwarded pgAdmin in your
Expand Down

0 comments on commit 3b443c9

Please sign in to comment.