Deploy the AWS Gateway API Controller on Amazon EKS¶
This Deployment Guide provides an end-to-end procedure to install the AWS Gateway API Controller with Amazon Elastic Kubernetes Service.
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 section below for instructions on how to install and run the controller on self-hosted Kubernetes clusters on AWS.
Prerequisites¶
Install these tools before proceeding:
- AWS CLI,
kubectl
- the Kubernetes CLI,helm
- the package manager for Kubernetes,eksctl
- the CLI for Amazon EKS,jq
- CLI to manipulate json files.
Setup¶
Set your AWS Region and Cluster Name as environment variables. See the Amazon VPC Lattice FAQs for a list of supported regions.
Create a cluster (optional)
You can easily create a cluster with eksctl
, the CLI for Amazon EKS:
Allow traffic from Amazon VPC Lattice
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 for details. Lattice has both an IPv4 and IPv6 prefix lists available.
-
Configure the EKS nodes' security group to receive traffic from the VPC Lattice network.
Note
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:
Set up IAM permissions
The AWS Gateway API Controller needs to have necessary permissions to operate.
-
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: -
Create the
aws-application-networking-system
namespace:
You can choose from Pod Identities (recommended) and IAM Roles For Service Accounts to set up controller permissions.
Set up the Pod Identities Agent
To use Pod Identities, we need to set up the Agent and to configure the controller's Kubernetes Service Account to assume necessary permissions with EKS Pod Identity.
Read if you are using a custom node role
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 if you are not using the AWS managed policy AmazonEKSWorkerNodePolicy.
- Run the following AWS CLI command to create the Pod Identity addon.
Assign role to Service Account
Create an IAM role and associate it with a Kubernetes service account.
-
Create a Service Account.
-
Create a trust policy file for the IAM role.
-
Create the role.
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" aws iam attach-role-policy --role-name VPCLatticeControllerIAMRole --policy-arn=$VPCLatticeControllerIAMPolicyArn export VPCLatticeControllerIAMRoleArn=$(aws iam list-roles --query 'Roles[?RoleName==`VPCLatticeControllerIAMRole`].Arn' --output text)
-
Create the association
You can use AWS IAM Roles for Service Accounts (IRSA) to assign the Controller necessary permissions via a ServiceAccount.
-
Create an IAM OIDC provider: See Creating an IAM OIDC provider for your cluster for details.
-
Create an iamserviceaccount for pod level permission:
Install the Controller¶
-
Run either
kubectl
orhelm
to deploy the controller. Check Environment Variables for detailed explanation of each configuration option. -
Create the
amazon-vpc-lattice
GatewayClass: