Skip to content

Commit 13a3eb3

Browse files
fix formatting issues in deploy.md
1 parent b0957fc commit 13a3eb3

File tree

1 file changed

+134
-130
lines changed

1 file changed

+134
-130
lines changed

docs/guides/deploy.md

Lines changed: 134 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
# Deploy the AWS Gateway API Controller on Amazon EKS
22

3-
This Deployment Guide provides an end-to-end procedure to install the AWS Gateway API Controller with [Amazon Elastic Kubernetes Service](https://aws.amazon.com/eks/).
3+
This Deployment Guide provides an end-to-end procedure to install the AWS Gateway API Controller with [Amazon Elastic Kubernetes Service](https://aws.amazon.com/eks/).
44

5-
Amazon EKS is a simple, recommended way of preparing a cluster for running services with AWS Gateway API Controller, however the AWS Gateway API Controller can be used on any Kubernetes cluster on AWS. Check out the [Advanced Configurations](advanced-configurations.md) section below for instructions on how to install and run the controller on self-hosted Kubernetes clusters on AWS.
5+
Amazon EKS is a simple, recommended way of preparing a cluster for running services with the AWS Gateway API Controller. However, the AWS Gateway API Controller can be used on any Kubernetes cluster on AWS. Check out the [Advanced Configurations](advanced-configurations.md) section below for instructions on how to install and run the controller on self-hosted Kubernetes clusters on AWS.
66

77
### Prerequisites
88

99
Install these tools before proceeding:
1010

1111
1. [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html),
12-
2. `kubectl` - [the Kubernetes CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/),
13-
3. `helm` - [the package manager for Kubernetes](https://helm.sh/docs/intro/install/),
14-
4. `eksctl`- [the CLI for Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/setting-up.html),
15-
5. `jq` - [CLI to manipulate json files](https://jqlang.github.io/jq/).
12+
2. `kubectl` [the Kubernetes CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/),
13+
3. `helm` [the package manager for Kubernetes](https://helm.sh/docs/intro/install/),
14+
4. `eksctl` [the CLI for Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/setting-up.html),
15+
5. `jq` [CLI to manipulate JSON files](https://jqlang.github.io/jq/).
1616

1717
### Setup
1818

1919
Set your AWS Region and Cluster Name as environment variables. See the [Amazon VPC Lattice FAQs](https://aws.amazon.com/vpc/lattice/faqs/) for a list of supported regions.
20-
```bash linenums="1"
21-
export AWS_REGION=<cluster_region>
22-
export CLUSTER_NAME=<cluster_name>
23-
```
20+
21+
```bash
22+
export AWS_REGION=<cluster_region>
23+
export CLUSTER_NAME=<cluster_name>
24+
```
2425

2526
**Install Gateway API CRDs**
2627

@@ -29,178 +30,181 @@ The latest Gateway API CRDs are available [here](https://gateway-api.sigs.k8s.io
2930
**Create a cluster (optional)**
3031

3132
You can easily create a cluster with `eksctl`, the CLI for Amazon EKS:
32-
```bash
33-
eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION
34-
```
33+
34+
```bash
35+
eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION
36+
```
3537

3638
**Allow traffic from Amazon VPC Lattice**
3739

38-
You must set up security groups so that they allow all Pods communicating with VPC Lattice to allow traffic from the VPC Lattice managed prefix lists. See [Control traffic to resources using security groups](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) for details. Lattice has both an IPv4 and IPv6 prefix lists available.
40+
You must set up security groups so that they allow all Pods communicating with VPC Lattice to allow traffic from the VPC Lattice managed prefix lists. See [Control traffic to resources using security groups](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) for details. Lattice has both IPv4 and IPv6 prefix lists available.
41+
42+
1. Configure the EKS nodes' security group to receive traffic from the VPC Lattice network.
3943

40-
1. Configure the EKS nodes' security group to receive traffic from the VPC Lattice network.
44+
```bash
45+
CLUSTER_SG=<your_node_security_group>
46+
```
4147

42-
```bash
43-
CLUSTER_SG=<your_node_security_group>
44-
```
45-
!!!Note
46-
If you have created the cluster with `eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION` command, you can use this command to export the Security Group ID:
48+
!!!Note
49+
If you have created the cluster with the `eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION` command, you can use the following command to export the Security Group ID:
4750

48-
```bash
49-
CLUSTER_SG=$(aws eks describe-cluster --name $CLUSTER_NAME --output json| jq -r '.cluster.resourcesVpcConfig.clusterSecurityGroupId')
50-
```
51+
```bash
52+
CLUSTER_SG=$(aws eks describe-cluster --name $CLUSTER_NAME --output json | jq -r '.cluster.resourcesVpcConfig.clusterSecurityGroupId')
53+
```
5154

52-
```bash linenums="1"
53-
PREFIX_LIST_ID=$(aws ec2 describe-managed-prefix-lists --query "PrefixLists[?PrefixListName=="\'com.amazonaws.$AWS_REGION.vpc-lattice\'"].PrefixListId" | jq -r '.[]')
54-
aws ec2 authorize-security-group-ingress --group-id $CLUSTER_SG --ip-permissions "PrefixListIds=[{PrefixListId=${PREFIX_LIST_ID}}],IpProtocol=-1"
55-
PREFIX_LIST_ID_IPV6=$(aws ec2 describe-managed-prefix-lists --query "PrefixLists[?PrefixListName=="\'com.amazonaws.$AWS_REGION.ipv6.vpc-lattice\'"].PrefixListId" | jq -r '.[]')
56-
aws ec2 authorize-security-group-ingress --group-id $CLUSTER_SG --ip-permissions "PrefixListIds=[{PrefixListId=${PREFIX_LIST_ID_IPV6}}],IpProtocol=-1"
57-
```
55+
```bash
56+
PREFIX_LIST_ID=$(aws ec2 describe-managed-prefix-lists --query "PrefixLists[?PrefixListName=='com.amazonaws.$AWS_REGION.vpc-lattice'].PrefixListId" | jq -r '.[]')
57+
aws ec2 authorize-security-group-ingress --group-id $CLUSTER_SG --ip-permissions "PrefixListIds=[{PrefixListId=${PREFIX_LIST_ID}}],IpProtocol=-1"
58+
PREFIX_LIST_ID_IPV6=$(aws ec2 describe-managed-prefix-lists --query "PrefixLists[?PrefixListName=='com.amazonaws.$AWS_REGION.ipv6.vpc-lattice'].PrefixListId" | jq -r '.[]')
59+
aws ec2 authorize-security-group-ingress --group-id $CLUSTER_SG --ip-permissions "PrefixListIds=[{PrefixListId=${PREFIX_LIST_ID_IPV6}}],IpProtocol=-1"
60+
```
5861

5962
**Set up IAM permissions**
6063

61-
The AWS Gateway API Controller needs to have necessary permissions to operate.
64+
The AWS Gateway API Controller needs to have the necessary permissions to operate.
65+
66+
1. Create a policy (`recommended-inline-policy.json`) in IAM with the following content that can invoke the Gateway API and copy the policy ARN for later use:
6267

63-
1. Create a policy (`recommended-inline-policy.json`) in IAM with the following content that can invoke the Gateway API and copy the policy arn for later use:
68+
```bash
69+
curl https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/recommended-inline-policy.json -o recommended-inline-policy.json
6470

65-
```bash linenums="1"
66-
curl https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/recommended-inline-policy.json -o recommended-inline-policy.json
67-
68-
aws iam create-policy \
69-
--policy-name VPCLatticeControllerIAMPolicy \
70-
--policy-document file://recommended-inline-policy.json
71+
aws iam create-policy \
72+
--policy-name VPCLatticeControllerIAMPolicy \
73+
--policy-document file://recommended-inline-policy.json
7174

72-
export VPCLatticeControllerIAMPolicyArn=$(aws iam list-policies --query 'Policies[?PolicyName==`VPCLatticeControllerIAMPolicy`].Arn' --output text)
73-
```
75+
export VPCLatticeControllerIAMPolicyArn=$(aws iam list-policies --query 'Policies[?PolicyName==`VPCLatticeControllerIAMPolicy`].Arn' --output text)
76+
```
77+
78+
2. Create the `aws-application-networking-system` namespace:
7479

75-
1. Create the `aws-application-networking-system` namespace:
76-
```bash
80+
```bash
7781
kubectl apply -f https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/deploy-namesystem.yaml
7882
```
7983

8084
You can choose from [Pod Identities](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html) (recommended) and [IAM Roles For Service Accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) to set up controller permissions.
8185

8286
=== "Pod Identities (recommended)"
8387

84-
**Set up the Pod Identities Agent**
88+
**Set up the Pod Identities Agent**
8589

86-
To use Pod Identities, we need to [set up the Agent](https://docs.aws.amazon.com/eks/latest/userguide/pod-id-agent-setup.html) and to configure the controller's Kubernetes Service Account to assume necessary permissions with EKS Pod Identity.
90+
To use Pod Identities, set up the [Pod Identity Agent](https://docs.aws.amazon.com/eks/latest/userguide/pod-id-agent-setup.html) and configure the controller's Kubernetes Service Account to assume necessary permissions with EKS Pod Identity.
8791

88-
!!!Note "Read if you are using a custom node role"
89-
The node role needs to have permissions for the Pod Identity Agent to do the `AssumeRoleForPodIdentity` action in the EKS Auth API. Follow [the documentation](https://docs.aws.amazon.com/eks/latest/userguide/pod-id-agent-setup.html) if you are not using the AWS managed policy [AmazonEKSWorkerNodePolicy](https://docs.aws.amazon.com/eks/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonEKSWorkerNodePolicy).
92+
!!!Note "Read if you are using a custom node role"
93+
The node role needs to have permissions for the Pod Identity Agent to perform the `AssumeRoleForPodIdentity` action in the EKS Auth API. Follow [the documentation](https://docs.aws.amazon.com/eks/latest/userguide/pod-id-agent-setup.html) if you are not using the AWS managed policy [AmazonEKSWorkerNodePolicy](https://docs.aws.amazon.com/eks/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonEKSWorkerNodePolicy).
9094

95+
1. Run the following AWS CLI command to create the Pod Identity addon:
9196

92-
1. Run the following AWS CLI command to create the Pod Identity addon.
93-
```bash
94-
aws eks create-addon --cluster-name $CLUSTER_NAME --addon-name eks-pod-identity-agent --addon-version v1.0.0-eksbuild.1
95-
```
96-
```bash
97-
kubectl get pods -n kube-system | grep 'eks-pod-identity-agent'
98-
```
97+
```bash
98+
aws eks create-addon --cluster-name $CLUSTER_NAME --addon-name eks-pod-identity-agent --addon-version v1.0.0-eksbuild.1
99+
```
99100

100-
**Assign role to Service Account**
101+
```bash
102+
kubectl get pods -n kube-system | grep 'eks-pod-identity-agent'
103+
```
101104

102-
Create an IAM role and associate it with a Kubernetes service account.
105+
**Assign role to Service Account**
103106

104-
1. Create a Service Account.
107+
1. Create a Service Account:
105108

106-
```bash
107-
cat >gateway-api-controller-service-account.yaml <<EOF
108-
apiVersion: v1
109-
kind: ServiceAccount
110-
metadata:
111-
name: gateway-api-controller
112-
namespace: aws-application-networking-system
113-
EOF
114-
kubectl apply -f gateway-api-controller-service-account.yaml
115-
```
109+
```bash
110+
cat >gateway-api-controller-service-account.yaml <<EOF
111+
apiVersion: v1
112+
kind: ServiceAccount
113+
metadata:
114+
name: gateway-api-controller
115+
namespace: aws-application-networking-system
116+
EOF
117+
kubectl apply -f gateway-api-controller-service-account.yaml
118+
```
116119

117-
1. Create a trust policy file for the IAM role.
120+
2. Create a trust policy file for the IAM role:
118121

119-
```bash
120-
cat >trust-relationship.json <<EOF
122+
```bash
123+
cat >trust-relationship.json <<EOF
124+
{
125+
"Version": "2012-10-17",
126+
"Statement": [
121127
{
122-
"Version": "2012-10-17",
123-
"Statement": [
124-
{
125-
"Sid": "AllowEksAuthToAssumeRoleForPodIdentity",
126-
"Effect": "Allow",
127-
"Principal": {
128-
"Service": "pods.eks.amazonaws.com"
129-
},
130-
"Action": [
131-
"sts:AssumeRole",
132-
"sts:TagSession"
133-
]
134-
}
128+
"Sid": "AllowEksAuthToAssumeRoleForPodIdentity",
129+
"Effect": "Allow",
130+
"Principal": {
131+
"Service": "pods.eks.amazonaws.com"
132+
},
133+
"Action": [
134+
"sts:AssumeRole",
135+
"sts:TagSession"
135136
]
136137
}
137-
EOF
138-
```
138+
]
139+
}
140+
EOF
141+
```
139142

140-
1. Create the role.
143+
3. Create the role:
141144

142-
```bash
143-
aws iam create-role --role-name VPCLatticeControllerIAMRole --assume-role-policy-document file://trust-relationship.json --description "IAM Role for AWS Gateway API Controller for VPC Lattice"
144-
aws iam attach-role-policy --role-name VPCLatticeControllerIAMRole --policy-arn=$VPCLatticeControllerIAMPolicyArn
145-
export VPCLatticeControllerIAMRoleArn=$(aws iam list-roles --query 'Roles[?RoleName==`VPCLatticeControllerIAMRole`].Arn' --output text)
146-
```
147-
148-
1. Create the association
145+
```bash
146+
aws iam create-role --role-name VPCLatticeControllerIAMRole --assume-role-policy-document file://trust-relationship.json --description "IAM Role for AWS Gateway API Controller for VPC Lattice"
147+
aws iam attach-role-policy --role-name VPCLatticeControllerIAMRole --policy-arn=$VPCLatticeControllerIAMPolicyArn
148+
export VPCLatticeControllerIAMRoleArn=$(aws iam list-roles --query 'Roles[?RoleName==`VPCLatticeControllerIAMRole`].Arn' --output text)
149+
```
150+
151+
4. Create the association:
149152

150-
```bash
151-
aws eks create-pod-identity-association --cluster-name $CLUSTER_NAME --role-arn $VPCLatticeControllerIAMRoleArn --namespace aws-application-networking-system --service-account gateway-api-controller
152-
```
153+
```bash
154+
aws eks create-pod-identity-association --cluster-name $CLUSTER_NAME --role-arn $VPCLatticeControllerIAMRoleArn --namespace aws-application-networking-system --service-account gateway-api-controller
155+
```
153156

154157
=== "IRSA"
155158

156-
You can use AWS IAM Roles for Service Accounts (IRSA) to assign the Controller necessary permissions via a ServiceAccount.
159+
You can use AWS IAM Roles for Service Accounts (IRSA) to assign the controller necessary permissions via a ServiceAccount.
157160

158-
1. Create an IAM OIDC provider: See [Creating an IAM OIDC provider for your cluster](https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html) for details.
159-
```bash
160-
eksctl utils associate-iam-oidc-provider --cluster $CLUSTER_NAME --approve --region $AWS_REGION
161-
```
161+
1. Create an IAM OIDC provider. See [Creating an IAM OIDC provider for your cluster](https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html) for details.
162162

163-
1. Create an iamserviceaccount for pod level permission:
163+
```bash
164+
eksctl utils associate-iam-oidc-provider --cluster $CLUSTER_NAME --approve --region $AWS_REGION
165+
```
164166

165-
```bash linenums="1"
166-
eksctl create iamserviceaccount \
167-
--cluster=$CLUSTER_NAME \
168-
--namespace=aws-application-networking-system \
169-
--name=gateway-api-controller \
170-
--attach-policy-arn=$VPCLatticeControllerIAMPolicyArn \
171-
--override-existing-serviceaccounts \
172-
--region $AWS_REGION \
173-
--approve
174-
```
167+
2. Create an IAM service account for pod-level permission:
168+
169+
```bash
170+
eksctl create iamserviceaccount \
171+
--cluster=$CLUSTER_NAME \
172+
--namespace=aws-application-networking-system \
173+
--name=gateway-api-controller \
174+
--attach-policy-arn=$VPCLatticeControllerIAMPolicyArn \
175+
--override-existing-serviceaccounts \
176+
--region $AWS_REGION \
177+
--approve
178+
```
175179

176180
### Install the Controller
177181

178-
1. Run **either** `kubectl` or `helm` to deploy the controller. Check [Environment Variables](../guides/environment.md) for detailed explanation of each configuration option.
182+
Run **either** `kubectl` or `helm` to deploy the controller. Check [Environment Variables](../guides/environment.md) for a detailed explanation of each configuration option.
179183

180-
=== "Helm"
184+
=== "Helm"
181185

182-
```bash linenums="1"
183-
# login to ECR
184-
aws ecr-public get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin public.ecr.aws
185-
# Run helm with either install or upgrade
186-
helm install gateway-api-controller \
187-
oci://public.ecr.aws/aws-application-networking-k8s/aws-gateway-controller-chart \
188-
--version=v1.1.0 \
189-
--set=serviceAccount.create=false \
190-
--namespace aws-application-networking-system \
191-
--set=log.level=info # use "debug" for debug level logs
192-
```
186+
```bash
187+
# login to ECR
188+
aws ecr-public get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin public.ecr.aws
193189

194-
=== "Kubectl"
190+
# Run helm with either install or upgrade
191+
helm install gateway-api-controller \
192+
oci://public.ecr.aws/aws-application-networking-k8s/aws-gateway-controller-chart \
193+
--version=v1.1.0 \
194+
--set=serviceAccount.create=false \
195+
--namespace aws-application-networking-system \
196+
--set=log.level=info # use "debug" for debug level logs
197+
```
195198

196-
```bash
197-
kubectl apply -f https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/deploy-v1.1.0.yaml
198-
```
199+
=== "Kubectl"
199200

201+
```bash
202+
kubectl apply -f https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/deploy-v1.1.0.yaml
203+
```
200204

201205
1. Create the `amazon-vpc-lattice` GatewayClass:
202-
```bash
203-
kubectl apply -f https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/gatewayclass.yaml
204-
```
205206

207+
```bash
208+
kubectl apply -f https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/gatewayclass.yaml
209+
```
206210

0 commit comments

Comments
 (0)