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

Commit 93351f7

Browse files
authored
Merge pull request #18 from alekhyal/master
Edits in README.md file
2 parents c82802a + 301b19e commit 93351f7

File tree

1 file changed

+66
-34
lines changed

1 file changed

+66
-34
lines changed

README.md

Lines changed: 66 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# Connecting to Cloud SQL from an application in Kubernetes Engine
22

33
## Table of Contents
4-
5-
* [Introduction](#introduction)
6-
* [Unprivileged service accounts](#unprivileged-service-accounts)
7-
* [Privileged service accounts in containers](#privileged-service-accounts-in-containers)
8-
* [Cloud SQL Proxy](#cloud-sql-proxy)
9-
* [Architecture](#architecture)
10-
* [Prerequisites](#prerequisites)
11-
* [Run Demo in a Google Cloud Shell](#run-demo-in-a-google-cloud-shell)
12-
* [Supported Operating Systems](#supported-operating-systems)
13-
* [Tools](#tools)
14-
* [Deployment](#deployment)
15-
* [Validation](#validation)
16-
* [Teardown](#teardown)
17-
* [Troubleshooting](#troubleshooting)
18-
* [Issue](#issue)
19-
* [Resolution](#resolution)
4+
<!-- TOC -->
5+
* [Introduction](#introduction)
6+
* [Unprivileged service accounts](#unprivileged-service-accounts)
7+
* [Privileged service accounts in containers](#privileged-service-accounts-in-containers)
8+
* [Cloud SQL Proxy](#cloud-sql-proxy)
9+
* [Architecture](#architecture)
10+
* [Prerequisites](#prerequisites)
11+
* [Run Demo in a Google Cloud Shell](#run-demo-in-a-google-cloud-shell)
12+
* [Supported Operating Systems](#supported-operating-systems)
13+
* [Tools](#tools)
14+
* [Install Cloud SDK](#install-cloud-sdk)
15+
* [Install kubectl CLI](#install-kubectl-cli)
16+
* [Authenticate gcloud](#authenticate-gcloud)
17+
* [Deployment](#deployment)
18+
* [Validation](#validation)
19+
* [Teardown](#teardown)
20+
* [Troubleshooting](#troubleshooting)
21+
* [Issue](#issue)
22+
* [Resolution](#resolution)
23+
<!-- TOC -->
2024

2125
## Introduction
2226

@@ -39,7 +43,7 @@ Kubernetes Engine
3943
* How to use the Cloud SQL Proxy to offload the work of connecting to your
4044
Cloud SQL instance and reduce your applications knowledge of your infrastructure
4145

42-
#### Unprivileged service accounts
46+
### Unprivileged service accounts
4347

4448
By default all Kubernetes Engine nodes are assigned the default Compute Engine
4549
service account. This service account is fairly high privilege and has access
@@ -51,15 +55,15 @@ a least-privilege service account for our Kubernetes Engine nodes and then
5155
create more specific (but still least-privilege) service accounts for our
5256
containers.
5357

54-
#### Privileged service accounts in containers
58+
### Privileged service accounts in containers
5559

5660
The only two ways to get service account credentials are 1.) through your host
5761
instance, which as we discussed we don't want, or 2.) through a credentials
5862
file. This demo will show you how to get this credentials file into your
5963
container running in Kubernetes Engine so your application has the privileges
6064
it needs.
6165

62-
#### Cloud SQL Proxy
66+
### Cloud SQL Proxy
6367

6468
The Cloud SQL Proxy allows you to offload the burden of creating and
6569
maintaining a connection to your Cloud SQL instance to the Cloud SQL Proxy
@@ -91,14 +95,6 @@ with a Cloud SQL Proxy instance](docs/architecture-diagram.png)
9195

9296
## Prerequisites
9397

94-
### Supported Operating Systems
95-
96-
* macOS
97-
* Linux
98-
* Google Cloud Shell
99-
100-
## Prerequisites
101-
10298
A Google Cloud account and project is required for this. Access to an existing Google Cloud
10399
project with the Kubernetes Engine service enabled If you do not have a Google Cloud account
104100
please signup for a free trial [here](https://cloud.google.com).
@@ -110,7 +106,8 @@ Click the button below to run the demo in a [Google Cloud Shell](https://cloud.g
110106
[![Open in Cloud Shell](http://gstatic.com/cloudssh/images/open-btn.svg)](https://console.cloud.google.com/cloudshell/open?git_repo=https%3A%2F%2Fgithub.com%2FGoogleCloudPlatform%2Fgke-cloud-sql-postgres-demo&page=editor&tutorial=README.md)
111107

112108
All the tools for the demo are installed. When using Cloud Shell execute the following
113-
command in order to setup gcloud cli.
109+
command in order to setup gcloud cli. When executing this command please setup your region
110+
and zone.
114111

115112
```console
116113
gcloud init
@@ -124,14 +121,32 @@ This project will run on macOS, Linux, or in a [Google Cloud Shell](https://clou
124121

125122
When not using Cloud Shell, the following tools are required.
126123

127-
1. gcloud (Google Cloud SDK version >= 200.0.0)
128-
2. kubectl >= 1.8.6
124+
1. [Google Cloud SDK (200.0.0 or later)](https://cloud.google.com/sdk/downloads)
125+
2. [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) >= 1.8.6
129126
3. bash or bash compatible shell
130127
4. A Google Cloud Platform project you have access to with the default network
131128
still intact
132129
5. Create a project and set core/project with `gcloud config set project <your_p
133130
roject>`
134131

132+
#### Install Cloud SDK
133+
The Google Cloud SDK is used to interact with your GCP resources.
134+
[Installation instructions](https://cloud.google.com/sdk/downloads) for multiple platforms are available online.
135+
136+
#### Install kubectl CLI
137+
138+
The kubectl CLI is used to interteract with both Kubernetes Engine and kubernetes in general.
139+
[Installation instructions](https://cloud.google.com/kubernetes-engine/docs/quickstart)
140+
for multiple platforms are available online.
141+
142+
### Authenticate gcloud
143+
144+
Prior to running this demo, ensure you have authenticated your gcloud client by running the following command:
145+
146+
```console
147+
gcloud auth application-default login
148+
```
149+
135150
If you don't have a Google Cloud account you can sign up for a [free account](https://cloud.google.com/).
136151

137152
## Deployment
@@ -176,15 +191,32 @@ password you created earlier to connect to 127.0.0.1:5432.
176191

177192
Validation is fully automated. The validation script checks for the existence
178193
of the Cloud SQL instance, the Kubernetes Engine cluster, and the running pod.
179-
All of these resources should exist after the deployment script completes. In
180-
order to validate you need to run **validate.sh**. The script takes the
181-
following parameters, in order:
194+
All of these resources should exist after the deployment script completes. Now that the application is deployed, we can validate these three deployments by executing:
195+
196+
```console
197+
make validate
198+
```
199+
The script takes the following parameters, in order:
182200
* INSTANCE_NAME - the name of the existing Cloud SQL instance
183201

202+
A successful output will look like this:
203+
```console
204+
Cloud SQL instance exists
205+
GKE cluster exists
206+
pgAdmin4 Deployment object exists
207+
```
208+
184209
## Teardown
185210

186211
Teardown is fully automated. The teardown script deletes every resource created
187-
in the deployment script. In order to teardown you need to run **teardown.sh**.
212+
in the deployment script. In order to teardown you need to run,
213+
214+
```console
215+
make teardown
216+
```
217+
218+
It will run **teardown.sh** which will destroy all of the resources created for this demonstration.
219+
188220
The script takes the following parameters, in order:
189221
* INSTANCE_NAME - the name of the existing Cloud SQL instance
190222

0 commit comments

Comments
 (0)