Skip to content

Commit 4a5c675

Browse files
Fixed indentation, add clarity to commands, added policy file (#58)
* fixed identation and add clarity to commands * adding inline policy in examples folder
1 parent 78665f0 commit 4a5c675

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

docs/how-it-works.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,27 @@ Run through them again for a second cluster to use with the extended example sho
5252
}
5353
]
5454
}
55-
56-
}
5755
```
5856
```bash
5957
aws iam create-policy \
6058
--policy-name VPCLatticeControllerIAMPolicy \
61-
--policy-document file://recommended-inline-policy.json
59+
--policy-document file://examples/recommended-inline-policy.json
6260
```
6361
1. Create the `system` namespace:
6462
```bash
6563
kubectl apply -f examples/deploy-namesystem.yaml
6664
```
67-
65+
1. Retrieve the policy ARN:
66+
```bash
67+
export VPCLatticeControllerIAMPolicyArn=$(aws iam list-policies --query 'Policies[?PolicyName==`VPCLatticeControllerIAMPolicy`].Arn' --output text)
68+
```
6869
1. Create an iamserviceaccount for pod level permission:
6970
```bash
7071
eksctl create iamserviceaccount \
71-
--cluster=<my-cluster-name> \
72+
--cluster=<my-cluster> \
7273
--namespace=system \
7374
--name=gateway-api-controller \
74-
--attach-policy-arn=<VPCLatticeControllerIAMPolicy ARN CREATED IN create-policy STEP> \
75+
--attach-policy-arn=$VPCLatticeControllerIAMPolicyArn \
7576
--override-existing-serviceaccounts \
7677
--region us-west-2 \
7778
--approve
@@ -239,16 +240,22 @@ For example, it will:
239240

240241
The following figure illustrates this:
241242

242-
![Multiple clusters/VPCs ervice-to-service communications](images/example2.png)
243+
![Multiple clusters/VPCs service-to-service communications](images/example2.png)
243244

244245
**Steps**
245246

246247
**Set up inventory on a second cluster**
247248

248249
1. Create a second cluster (using the same instructions used to create the first).
249250

250-
1. Switch you credentials to use the second cluster
251-
251+
1. Ensure you're using the second cluster profile.
252+
```bash
253+
kubectl config get-contexts
254+
```
255+
If your profile is set to the first cluster, switch your credentials to use the second cluster:
256+
```bash
257+
kubectl config use-context <yourcluster2info>
258+
```
252259
1. Create a Kubernetes inventory-ver2 service in the second cluster:
253260
```bash
254261
kubectl apply -f examples/inventory-ver2.yaml
@@ -261,7 +268,7 @@ The following figure illustrates this:
261268

262269
1. Switch credentials back to the first cluster
263270
```bash
264-
kubectl config use-context <yourcluster2info>
271+
kubectl config use-context <yourcluster1info>
265272
```
266273
1. Import the Kubernetes inventory-ver2 into first cluster:
267274
```bash
@@ -276,28 +283,23 @@ The following figure illustrates this:
276283
kubectl exec -ti parking-6cdcd5b4b4-bbzvt sh
277284
```
278285
1. From inside of the pod, use `curl` to connect to the inventory service:
279-
```bash
280-
curl inventory-0cd1a223d518754f3.7d67968.vpc-service-network-svcs.us-west-2.amazonaws.com
281-
```
282-
```
283-
Requesting to Pod(inventory-ver1-7bb6989d9d-2p2hk): inventory-ver1 handler pod <----> in 1st cluster
284-
```
286+
285287
```bash
286288
for ((i=1;i<=30;i++)); do curl "inventory-default-0f89d8ff5e98400d0.7d67968.vpc-lattice-svcs.us-west-2.on.aws"; done
287289
```
288290
```
289-
Requsting to Pod(inventory-ver1-74fc59977-wg8br): Inventory-ver1 handler pod
290-
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod <----> in 2nd cluster
291-
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
292-
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
293-
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
294-
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver1 handler pod <----> in 1st cluster
295-
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
296-
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver2 handler pod
297-
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver2 handler pod
298-
Requsting to Pod(inventory-ver1-74fc59977-wg8br): Inventory-ver1 handler pod....
299-
291+
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod <----> in 2nd cluster
292+
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
293+
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
294+
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
295+
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver1 handler pod <----> in 1st cluster
296+
Requsting to Pod(inventory-ver2-6dc74b45d8-rlnlt): Inventory-ver2 handler pod
297+
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver2 handler pod
298+
Requsting to Pod(inventory-ver2-6dc74b45d8-95rsr): Inventory-ver2 handler pod
299+
Requsting to Pod(inventory-ver1-74fc59977-wg8br): Inventory-ver1 handler pod....
300300
```
301+
You can see that the traffic is distributed between *inventory-ver1* and *inventory-ver2* as expected.
302+
301303
## Understanding the Gateway API Controller
302304

303305
For medium and large-scale customers, applications can often spread across multiple areas of a cloud.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Action": [
7+
"vpc-lattice:*",
8+
"iam:CreateServiceLinkedRole",
9+
"ec2:DescribeVpcs",
10+
"ec2:DescribeSubnets"
11+
],
12+
"Resource": "*"
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)