diff --git a/README-QWIKLABS.md b/README-QWIKLABS.md index a4d9dd9..b26389e 100644 --- a/README-QWIKLABS.md +++ b/README-QWIKLABS.md @@ -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 `````` in the "Email -Address" field and `````` you defined earlier to login to the console. -From there you can click "Add New Server" and use the `````` and -`````` 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 443/TCP 96m +pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer 80:31789/TCP 45m + +You can connect to the pgAdmin in your browser, using . + +http:// + +Use the in the "Email Address" field and you defined earlier to login to the console. From there you can click "Add New Server" and use the and 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 + + ## Validation diff --git a/README.md b/README.md index d4c1ce3..baf1914 100644 --- a/README.md +++ b/README.md @@ -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 443/TCP 96m +pgadmin4-deployment-6769d76d4c-97kn8 LoadBalancer 80:31789/TCP 45m + +You can connect to the pgAdmin in your browser, using . + +http:// + +Use the in the "Email Address" field and you defined earlier to login to the console. From there you can click "Add New Server" and use the and 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 + + +### 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 @@ -218,7 +261,7 @@ It will run **teardown.sh** which will destroy all of the resources created for The script takes the following parameters, in order: * INSTANCE_NAME - the name of the existing Cloud SQL instance -**teardown.sh** will run the following scripts: +**teardown.sh** will run the following scripts 1. delete_resources.sh - deletes everything but the Cloud SQL instance 2. delete_instance.sh - deletes the Cloud SQL instance