File tree Expand file tree Collapse file tree 3 files changed +52
-4
lines changed
example-gke-k8s-multi-region
example-gke-k8s-service-lb Expand file tree Collapse file tree 3 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ Example showing how to create a Kubernetes Service tpye LoadBalancer to GKE from
179
179
180
180
Example showing how to create an L7 HTTP load balancer across multiple regional GKE clusters.
181
181
182
+ [ ![ button] ( http://gstatic.com/cloudssh/images/open-btn.png )] ( https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/terraform-google-examples&page=editor&tutorial=example-gke-k8s-multi-region/README.md )
183
+
182
184
<a href =" https://concourse-tf.gcp.solutions/teams/main/pipelines/tf-examples-gke-multi-region " target =" _blank " >
183
185
<img src =" https://concourse-tf.gcp.solutions/api/v1/teams/main/pipelines/tf-examples-gke-multi-region/badge " /></a >
184
186
Original file line number Diff line number Diff line change 2
2
3
3
This example shows how to do multi-region ingress using an L7 HTTP Load Balancer with regional clusters.
4
4
5
+ [ ![ button] ( http://gstatic.com/cloudssh/images/open-btn.png )] ( https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/terraform-google-examples&page=editor&tutorial=example-gke-k8s-multi-region/README.md )
6
+
7
+ <a href =" https://concourse-tf.gcp.solutions/teams/main/pipelines/tf-examples-gke-multi-region " target =" _blank " >
8
+ <img src =" https://concourse-tf.gcp.solutions/api/v1/teams/main/pipelines/tf-examples-gke-multi-region/badge " /></a >
9
+
5
10
** Figure 1.** * diagram of Google Cloud resources*
6
11
7
12
![ architecture diagram] ( ./diagram.png )
8
13
14
+ ## Install Terraform
15
+
16
+ 1 . Install Terraform if it is not already installed (visit [ terraform.io] ( https://terraform.io ) for other distributions):
17
+
18
+ ```
19
+ ./terraform-install.sh
20
+ ```
21
+
22
+ ## Change to the example directory
23
+
24
+ ```
25
+ cd example-gke-k8s-multi-region/
26
+ ```
27
+
9
28
## Set up the environment
10
29
30
+ 1 . Set the project, replace ` YOUR_PROJECT ` with your project ID:
31
+
11
32
```
12
- gcloud auth application-default login
33
+ PROJECT=YOUR_PROJECT
34
+ ```
35
+
36
+ ```
37
+ gcloud config set project ${PROJECT}
38
+ ```
39
+
40
+ 2 . Configure the environment for Terraform:
41
+
42
+ ```
43
+ [[ $CLOUD_SHELL ]] || gcloud auth application-default login
13
44
export GOOGLE_PROJECT=$(gcloud config get-value project)
14
45
```
15
46
16
47
## Run Terraform
17
48
18
49
```
19
50
terraform init
20
- terraform plan
21
51
terraform apply
22
52
```
23
53
24
54
## Testing
25
55
26
- Open the address of the load balancer in a browser once it is ready:
56
+ 1 . Wait for the load balancer to be provisioned:
57
+
58
+ ```
59
+ ./test.sh
60
+ ```
61
+
62
+ 2 . Open the address of the load balancer:
27
63
28
64
```
29
- (until curl --connect-timeout 1 -sf -o /dev/null http://$(terraform output load-balancer-ip); do echo "Waiting for Load Balancer... "; sleep 5 ; done) && open http://$(terraform output load-balancer-ip)
65
+ echo http://$(terraform output load-balancer-ip)
30
66
```
31
67
32
68
## Cleanup
33
69
70
+ 1 . Delete resources created by terraform:
71
+
34
72
```
35
73
terraform destroy
36
74
```
Original file line number Diff line number Diff line change @@ -73,4 +73,12 @@ gcloud container clusters get-credentials $(terraform output cluster_name) --zon
73
73
74
74
```
75
75
kubectl get pods -n staging
76
+ ```
77
+
78
+ ## Cleanup
79
+
80
+ 1 . Delete resources created by terraform:
81
+
82
+ ```
83
+ terraform destroy
76
84
```
You can’t perform that action at this time.
0 commit comments