File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed
example-gke-k8s-service-lb Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,8 @@ Example showing how to deploy Helm releases to GKE from Terraform
170
170
171
171
Example showing how to create a Kubernetes Service tpye LoadBalancer to GKE from Terraform
172
172
173
+ [ ![ 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-service-lb/README.md )
174
+
173
175
<a href =" https://concourse-tf.gcp.solutions/teams/main/pipelines/tf-examples-gke-service-lb " target =" _blank " >
174
176
<img src =" https://concourse-tf.gcp.solutions/api/v1/teams/main/pipelines/tf-examples-gke-service-lb/badge " /></a >
175
177
Original file line number Diff line number Diff line change 2
2
3
3
Example showing how to integrate the Terraform kubernetes provider with a Google Kubernetes Engine cluster.
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-service-lb/README.md )
6
+
7
+ <a href =" https://concourse-tf.gcp.solutions/teams/main/pipelines/tf-examples-gke-service-lb " target =" _blank " >
8
+ <img src =" https://concourse-tf.gcp.solutions/api/v1/teams/main/pipelines/tf-examples-gke-service-lb/badge " /></a >
9
+
10
+ ## Install Terraform
11
+
12
+ 1 . Install Terraform if it is not already installed (visit [ terraform.io] ( https://terraform.io ) for other distributions):
13
+
14
+ ```
15
+ ./terraform-install.sh
16
+ ```
17
+
18
+ ## Change to the example directory
19
+
20
+ ```
21
+ cd example-gke-service-lb/
22
+ ```
23
+
5
24
## Set up the environment
6
25
26
+ 1 . Set the project, replace ` YOUR_PROJECT ` with your project ID:
27
+
28
+ ```
29
+ PROJECT=YOUR_PROJECT
30
+ ```
31
+
32
+ ```
33
+ gcloud config set project ${PROJECT}
7
34
```
8
- gcloud auth application-default login
35
+
36
+ 2 . Configure the environment for Terraform:
37
+
38
+ ```
39
+ [[ $CLOUD_SHELL ]] || gcloud auth application-default login
9
40
export GOOGLE_PROJECT=$(gcloud config get-value project)
10
41
```
11
42
12
43
## Run Terraform
13
44
14
45
```
15
46
terraform init
16
- terraform plan
17
47
terraform apply
18
48
```
19
49
20
50
## Testing
21
51
52
+ 1 . Wait for the load balancer to be provisioned:
53
+
54
+ ```
55
+ ./test.sh
56
+ ```
57
+
58
+ 2 . Verify response from load balancer:
59
+
22
60
```
23
61
curl http://$(terraform output load-balancer-ip)
24
62
```
25
63
26
64
## Connecting with kubectl
27
65
66
+ 1 . Get the cluster credentials and configure kubectl:
67
+
28
68
```
29
69
gcloud container clusters get-credentials $(terraform output cluster_name) --zone $(terraform output cluster_zone)
70
+ ```
71
+
72
+ 2 . Verify kubectl connectivity:
30
73
74
+ ```
31
75
kubectl get pods -n staging
32
76
```
You can’t perform that action at this time.
0 commit comments