How to Install App Mesh on AWS EKS


You can follow the steps below to install App Mesh on AWS EKS (Kubernetes).

Step 1 – Prerequisites

curl -o pre_upgrade_check.sh https://raw.githubusercontent.com/aws/eks-charts/master/stable/appmesh-controller/upgrade/pre_upgrade_check.sh
sh ./pre_upgrade_check.sh

Step 2 – Add Helm Repo

helm repo add eks https://aws.github.io/eks-charts

Step 3 – Add Custom Resource Definitions (CRDs)

kubectl apply -k "https://github.com/aws/eks-charts/stable/appmesh-controller/crds?ref=master"

Step 4 – Create a Namespace for App Mesh

kubectl create ns appmesh-system

Step 5 – Set Environment Variables

You will need to set a couple of environment variables to make things easier later.

export CLUSTER_NAME=cluster-name
export ACCOUNT_ID=111122223333
export AWS_REGION=eu-west-1

aws eks list-clusters will help you get the CLUSTER_NAME.

aws sts get-caller-identity will help you get the ACCOUNT_ID.

AWS_REGION needs to be the region where your EKS cluster has been setup.

Step 6 – Add an IAM OIDC provider

eksctl utils associate-iam-oidc-provider \
    --region=$AWS_REGION \
    --cluster $CLUSTER_NAME \
    --approve

Step 7 – Create an IAM Service Account

eksctl create iamserviceaccount \
    --cluster $CLUSTER_NAME \
    --namespace appmesh-system \
    --name appmesh-controller \
    --attach-policy-arn arn:aws:iam::aws:policy/AWSCloudMapFullAccess,arn:aws:iam::aws:policy/AWSAppMeshFullAccess,arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess \
    --override-existing-serviceaccounts \
    --approve

Step 8 – Install the App Mesh Controller using Helm

helm upgrade -i appmesh-controller eks/appmesh-controller \
    --namespace appmesh-system \
    --set region=$AWS_REGION \
    --set serviceAccount.create=false \
    --set serviceAccount.name=appmesh-controller \
    --set log.level=debug

Step 9 – Note the App Mesh Deployment

kubectl get deployment appmesh-controller \
    -n appmesh-system \
    -o json  | jq -r ".spec.template.spec.containers[].image"

Step 10 – Create a Fargate Profile in the EKS cluster

eksctl create fargateprofile --cluster $CLUSTER_NAME --name appmesh-system --namespace appmesh-system