Skip to content

Commit 8002f3a

Browse files
committed
cleanup: incorporate pr comments
1 parent 4aeb769 commit 8002f3a

File tree

5 files changed

+53
-51
lines changed

5 files changed

+53
-51
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ EXTERNAL-IP
142142

143143
- **Workload Identity**: [See these instructions.](./docs/workload-identity.md)
144144
- **Cloud SQL**: [See these instructions](./extras/cloudsql) to replace the in-cluster databases with hosted Google Cloud SQL.
145-
- **Multicluster with Cloud SQL**: [See these instructions](./extras/cloudsql-multicluster) to replicate the app across two regions using GKE, Multi-cluster Ingress, and Google Cloud SQL.
145+
- **Multi Cluster with Cloud SQL**: [See these instructions](./extras/cloudsql-multicluster) to replicate the app across two regions using GKE, Multi Cluster Ingress, and Google Cloud SQL.
146146
- **Istio**: Apply `istio-manifests/` to your cluster to access the frontend through the IngressGateway.
147147
- **Anthos Service Mesh**: ASM requires Workload Identity to be enabled in your GKE cluster. [See the workload identity instructions](./docs/workload-identity.md) to configure and deploy the app. Then, apply `istio-manifests/` to your cluster to configure frontend ingress.
148148
- **Java Monolith (VM)**: We provide a version of this app where the three Java microservices are coupled together into one monolithic service, which you can deploy inside a VM (eg. Google Compute Engine). See the [ledgermonolith](./src/ledgermonolith) directory.

extras/asm-multicluster/README.md

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
# Anthos Service Mesh - Multicluster
1+
# Anthos Service Mesh - Multi Cluster
22

3-
This demo shows how to install Bank of Anthos across 2 clusters, using [Anthos Service Mesh endpoint discovery](https://cloud.google.com/service-mesh/docs/managed-control-plane#configure_endpoint_discovery_only_for_multi-cluster_installations) for cross-cluster routing.
3+
This demo shows how to install Bank of Anthos across 2 clusters, using [Anthos Service Mesh endpoint discovery](https://cloud.google.com/service-mesh/docs/managed-control-plane#configure_endpoint_discovery_only_for_multi-cluster_installations) for cross-cluster routing.
44

5-
For a "replicated" multicluster setup with no cross-cluster traffic, see the [Cloud SQL + Multicluster](/extras/cloudsql-multicluster) demo.
5+
For a "replicated" multicluster setup with no cross-cluster traffic, see the [Cloud SQL + Multi Cluster](/extras/cloudsql-multicluster) demo.
66

7-
## Architecture
7+
## Architecture
88

99
![architecture](screenshots/architecture.png)
1010

1111

12-
## Prerequisites
12+
## Prerequisites
1313

14-
1. A Google Cloud project.
15-
2. The following tools installed in your local environment:
16-
- [gcloud](https://cloud.google.com/sdk/docs/install), up to date with `gcloud components update`
14+
1. A Google Cloud project.
15+
2. The following tools installed in your local environment:
16+
- [gcloud](https://cloud.google.com/sdk/docs/install), up to date with `gcloud components update`
1717
- [kubectl](https://cloud.google.com/sdk/gcloud/reference/components/install) - you can install this via gcloud: `gcloud components install kubectl`
1818
- [kubectx](https://github.com/ahmetb/kubectx#installation)
19-
- (MacOS only) coreutils: `brew install coreutils`
20-
- (MacOS only) jq: `brew install jq`
21-
- (MacOS only) kpt:
19+
- (MacOS only) coreutils: `brew install coreutils`
20+
- (MacOS only) jq: `brew install jq`
21+
- (MacOS only) kpt:
2222
```
2323
brew tap GoogleContainerTools/kpt https://github.com/GoogleContainerTools/kpt.git
2424
brew install kpt
2525
```
2626

27-
## Steps
27+
## Steps
2828

2929
1. **Set variables.**
3030

3131
```
32-
export PROJECT_ID="<your-project-id>"
32+
export PROJECT_ID="<your-project-id>"
3333
gcloud config set project $PROJECT_ID
3434
```
3535

3636

37-
2. **Enable APIs.**
37+
2. **Enable APIs.**
3838

3939
```
40-
gcloud services enable container.googleapis.com anthos.googleapis.com
40+
gcloud services enable container.googleapis.com anthos.googleapis.com
4141
```
4242

43-
3. **Make sure you've `cd`-ed into this directory, then run the cluster setup script**. This script creates 2 GKE clusters, `cluster-1` and `cluster-2`, installs Anthos Service Mesh, and sets up cross-cluster endpoint discovery. This script takes about 10 minutes to run.
43+
3. **Make sure you've `cd`-ed into this directory, then run the cluster setup script**. This script creates 2 GKE clusters, `cluster-1` and `cluster-2`, installs Anthos Service Mesh, and sets up cross-cluster endpoint discovery. This script takes about 10 minutes to run.
4444

4545
```
46-
cd extras/asm-multicluster/
46+
cd extras/asm-multicluster/
4747
./cluster-setup.sh
4848
```
4949

50-
4. **Verify that your local kubectx is set up** for `cluster-1` and `cluster-2`, and that you can access both clusters.
50+
4. **Verify that your local kubectx is set up** for `cluster-1` and `cluster-2`, and that you can access both clusters.
5151

5252
```
53-
kubectx cluster-1
54-
kubectl get nodes
53+
kubectx cluster-1
54+
kubectl get nodes
5555
```
5656

57-
You should see:
57+
You should see:
5858

5959
```
6060
NAME STATUS ROLES AGE VERSION
@@ -64,24 +64,24 @@ gke-cluster-1-default-pool-855fbe61-f3qw Ready <none> 62m v1.18.15-gke.
6464
gke-cluster-1-default-pool-855fbe61-tw2z Ready <none> 62m v1.18.15-gke.1501
6565
```
6666

67-
5. **Deploy the Bank of Anthos app across both clusters**. This will deploy the frontend and Python backends to cluster-1, and the Java backends to cluster 2. Note that ASM endpoint discovery only works if all the Kubernetes Services are deployed to both clusters, so that's what we're doing here.
67+
5. **Deploy the Bank of Anthos app across both clusters**. This will deploy the frontend and Python backends to cluster-1, and the Java backends to cluster 2. Note that ASM endpoint discovery only works if all the Kubernetes Services are deployed to both clusters, so that's what we're doing here.
6868

69-
**Note** - you should run these commands from this directory. (`extras/asm-multicluster`).
69+
**Note** - you should run these commands from this directory. (`extras/asm-multicluster`).
7070

7171
```
72-
kubectx cluster-1
73-
kubectl apply -f services-all.yaml
72+
kubectx cluster-1
73+
kubectl apply -f services-all.yaml
7474
kubectl apply -f ../../kubernetes-manifests/config.yaml
7575
kubectl apply -f ../../extras/jwt/jwt-secret.yaml
76-
kubectl apply -f ../../kubernetes-manifests/accounts-db.yaml
76+
kubectl apply -f ../../kubernetes-manifests/accounts-db.yaml
7777
kubectl apply -f ../../kubernetes-manifests/contacts.yaml
7878
kubectl apply -f ../../kubernetes-manifests/frontend.yaml
7979
kubectl apply -f ../../kubernetes-manifests/userservice.yaml
8080
kubectl apply -f ../../kubernetes-manifests/loadgenerator.yaml
8181
kubectl apply -f ../../istio-manifests/frontend-ingress.yaml
8282
83-
kubectx cluster-2
84-
kubectl apply -f services-all.yaml
83+
kubectx cluster-2
84+
kubectl apply -f services-all.yaml
8585
kubectl apply -f ../../kubernetes-manifests/config.yaml
8686
kubectl apply -f ../../extras/jwt/jwt-secret.yaml
8787
kubectl apply -f ../../kubernetes-manifests/ledger-db.yaml
@@ -90,13 +90,13 @@ kubectl apply -f ../../kubernetes-manifests/ledger-writer.yaml
9090
kubectl apply -f ../../kubernetes-manifests/transaction-history.yaml
9191
```
9292

93-
6. **Verify that the pods start up successfully.** Note that you should see 2 containers per pod `(2/2)`, one containing the Bank of Anthos service container, the other containing the ASM sidecar proxy (Envoy).
93+
6. **Verify that the pods start up successfully.** Note that you should see 2 containers per pod `(2/2)`, one containing the Bank of Anthos service container, the other containing the ASM sidecar proxy (Envoy).
9494

9595
```
96-
kubectx cluster-1; kubectl get pods
96+
kubectx cluster-1; kubectl get pods
9797
```
9898

99-
You should see:
99+
You should see:
100100

101101
```
102102
NAME READY STATUS RESTARTS AGE
@@ -107,13 +107,13 @@ loadgenerator-797dfd6c5c-r86vn 2/2 Running 0 14m
107107
userservice-7c9bc855f5-ff8tq 2/2 Running 0 14m
108108
```
109109

110-
Do the same for cluster-2:
110+
Do the same for cluster-2:
111111

112112
```
113-
kubectx cluster-2; kubectl get pods
113+
kubectx cluster-2; kubectl get pods
114114
```
115115

116-
You should see:
116+
You should see:
117117

118118
```
119119
NAME READY STATUS RESTARTS AGE
@@ -123,27 +123,27 @@ ledgerwriter-7d88d5898c-vhs5l 2/2 Running 0 14m
123123
transactionhistory-84cf479f65-lzgdt 2/2 Running 0 14m
124124
```
125125

126-
7. **Access the Bank of Anthos frontend** using the Istio IngressGateway's LoadBalancer IP.
126+
7. **Access the Bank of Anthos frontend** using the Istio IngressGateway's LoadBalancer IP.
127127

128128
```
129-
kubectx cluster-1; kubectl get svc istio-ingressgateway -n istio-system
129+
kubectx cluster-1; kubectl get svc istio-ingressgateway -n istio-system
130130
131131
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
132132
istio-ingressgateway LoadBalancer 10.7.254.103 <EXTERNAL_IP> 15021:30429/TCP,80:32101/TCP,443:31503/TCP,15012:30573/TCP,15443:31131/TCP 21m
133133
```
134134

135-
Navigate to the `EXTERNAL_IP` in a browser; you should see the Bank of Anthos login page.
135+
Navigate to the `EXTERNAL_IP` in a browser; you should see the Bank of Anthos login page.
136136

137-
8. **Open the Google Cloud Console, and navigate to Anthos > Service Mesh**. You may see an Anthos window pop up - click "Enable."
137+
8. **Open the Google Cloud Console, and navigate to Anthos > Service Mesh**. You may see an Anthos window pop up - click "Enable."
138138

139139
![enable anthos](screenshots/enable-anthos.png)
140140

141141

142-
9. View the Bank of Anthos services in the Anthos Service Mesh dashboard. In the Table view, you should see metrics populated for services in both cluster-1 and cluster 2.
142+
9. View the Bank of Anthos services in the Anthos Service Mesh dashboard. In the Table view, you should see metrics populated for services in both cluster-1 and cluster 2.
143143

144144
![table](screenshots/asm-table.png)
145145

146146

147-
In the topology view, you should see traffic flowing from cluster 1 services (frontend) to cluster 2 services (eg. transactionhistory).
147+
In the topology view, you should see traffic flowing from cluster 1 services (frontend) to cluster 2 services (eg. transactionhistory).
148148

149149
![topology](screenshots/asm-topology.png)

extras/cloudsql-multicluster/README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Multi-cluster Bank of Anthos with Cloud SQL
1+
# Multi Cluster Bank of Anthos with Cloud SQL
22

33
This doc contains instructions for deploying the Cloud SQL version of Bank of Anthos in a multi-region high availability / global configuration.
44

5-
The use case for this setup is to demo running a global, scaled app, where even if one cluster goes down, users will be routed to the next available cluster. These instructions also show how to use [Multi-cluster Ingress](https://cloud.google.com/kubernetes-engine/docs/concepts/multi-cluster-ingress) to route users to the closest GKE cluster, demonstrating a low-latency use case.
5+
The use case for this setup is to demo running a global, scaled app, where even if one cluster goes down, users will be routed to the next available cluster. These instructions also show how to use [Multi Cluster Ingress](https://cloud.google.com/kubernetes-engine/docs/concepts/multi-cluster-ingress) to route users to the closest GKE cluster, demonstrating a low-latency use case.
66

77
This guide has two parts to it:
88
1. Deploy Bank of Anthos on 2 GKE clusters with **Multi Cluster Ingress** for
@@ -63,6 +63,8 @@ gcloud container clusters create ${CLUSTER_2_NAME} \
6363
--workload-pool="${PROJECT_ID}.svc.id.goog" --enable-ip-alias
6464
```
6565

66+
> Note: It can take more than **10 minutes** for both clusters to get created.
67+
6668
5. **Configure kubectx for the clusters.**
6769

6870
```
@@ -92,6 +94,7 @@ kubectx cluster1
9294
kubectx cluster2
9395
../cloudsql/create_cloudsql_instance.sh
9496
```
97+
> Note: Setting up the `CloudSQL` instance can sometimes take more than 10 minutes.
9598
9699
8. **Create Cloud SQL admin secrets** in your GKE clusters. This gives your in-cluster Cloud SQL clients a username and password to access Cloud SQL. (Note that admin/admin credentials are for demo use only and should never be used in a production environment.)
97100

@@ -110,7 +113,6 @@ kubectl create secret -n ${NAMESPACE} generic cloud-sql-admin \
110113
--from-literal=connectionName=${INSTANCE_CONNECTION_NAME}
111114
```
112115

113-
114116
9. **Deploy the DB population jobs.** These are one-off bash scripts that initialize the Accounts and Ledger databases with data. You only need to run these Jobs once, so we deploy them only on `cluster1`.
115117

116118
```
@@ -151,22 +153,22 @@ kubectx cluster2
151153
kubectl delete svc frontend -n ${NAMESPACE}
152154
```
153155

154-
13. **Run the Multi-cluster Ingress setup script.** This registers both GKE clusters to Anthos with ***"memberships"*** and sets cluster 1 as the ***"config cluster"*** to administer the Multi-cluster Ingress resources.
156+
13. **Run the Multi Cluster Ingress setup script.** This registers both GKE clusters to Anthos with ***"memberships"*** and sets cluster 1 as the ***"config cluster"*** to administer the Multi Cluster Ingress resources.
155157

156158
```
157159
./register_clusters.sh
158160
```
159161

160162

161-
14. **Create Multi-cluster Ingress resources for global routing.** This YAML file contains two resources a headless Multicluster Kubernetes Service ("MCS") mapped to the `frontend` Pods, and a multi cluster Ingress resource, `frontend-global-ingress`, with `frontend-mcs` as the MCS backend. Note that we're only deploying this to Cluster 1, which we've designated as the multicluster ingress "config cluster."
163+
14. **Create Multi Cluster Ingress resources for global routing.** This YAML file contains two resources a headless Multi Cluster Kubernetes Service ("MCS") mapped to the `frontend` Pods, and a Multi Cluster Ingress resource, `frontend-global-ingress`, with `frontend-mcs` as the MCS backend. Note that we're only deploying this to Cluster 1, which we've designated as the Multi Cluster Ingress "config cluster."
162164

163165
```
164166
kubectx cluster1
165167
kubectl apply -n ${NAMESPACE} -f multicluster-ingress.yaml
166168
```
167169

168170

169-
15. **Verify that the multicluster ingress resource was created.** Look for the `Status` field to be populated with two Network Endpoint Groups (NEGs) corresponding to the regions where your 2 GKE clusters are running.
171+
15. **Verify that the Multi Cluster Ingress resource was created.** Look for the `Status` field to be populated with two Network Endpoint Groups (NEGs) corresponding to the regions where your 2 GKE clusters are running.
170172

171173
> **Note:** It may take up to 90 seconds before a `VIP` is assigned to the
172174
> MultiClusterIngress resource.

extras/cloudsql-multicluster/register_clusters.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ echo "🌏 Listing your Anthos cluster memberships:"
6565
gcloud container hub memberships list
6666

6767

68-
echo "🌏 Adding cluster 1 as the Multi-cluster ingress config cluster..."
68+
echo "🌏 Adding cluster 1 as the Multi Cluster Ingress config cluster..."
6969
gcloud alpha container hub ingress enable \
7070
--config-membership=projects/${PROJECT_ID}/locations/global/memberships/${CLUSTER_1_NAME}
7171

7272
gcloud alpha container hub ingress describe
7373

74-
echo "⭐️ Done."
74+
echo "⭐️ Done."

extras/cloudsql-multicluster/tls-for-mci.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ created in the [Multi Cluster Bank of Anthos with Cloud SQL](README.md) guide.
1212
- This guide assumes that all the environment variables and **kubectx**(s) -
1313
_cluster1 & cluster2_ - are still valid
1414
- This guide assumes that all the commands are executed from the same directory
15-
as this README ***`(extras/cloudsql-multicluster/tls-for-mci.md)`***
15+
as this file ***`(extras/cloudsql-multicluster/tls-for-mci.md)`***
1616

1717
---
1818

@@ -57,7 +57,7 @@ envsubst < multicluster-ingress-https.template > multicluster-ingress-https.yaml
5757
kubectl apply -n ${NAMESPACE} -f multicluster-ingress-https.yaml
5858
```
5959

60-
6. **Verify that the multicluster ingress resource was updated.**
60+
6. **Verify that the Multi Cluster Ingress resource was updated.**
6161
This may take a few minutes. Wait until the **VIP** of the `MultiClusterIngress`
6262
has been updated to your newly created STATIC_IP.
6363

0 commit comments

Comments
 (0)