install with script
#!/bin/bash
: this sh is for installation of aws lb controller
echo "install aws lb controller"
export clusterName=felix-tfc
export seed=${RANDOM}
export policyname=AWSLoadBalancerControllerIAMPolicy${seed}
echo "create iam policy"
aws iam create-policy --policy-name $policyname --policy-document file://iam_policy_cn.json --no-cli-pager
policyarn=$(aws iam list-policies --query "Policies[?PolicyName==\`${policyname}\`].Arn" --output text --no-cli-pager)
export policyarn
eksctl utils associate-iam-oidc-provider --region=cn-north-1 --cluster=felix-tfc --approve
aws cloudformation delete-stack --stack-name eksctl-felix-tfc-addon-iamserviceaccount-kube-system-aws-load-balancer-controller || true
echo "will sleep 200 for cfn deletion"
sleep 200
eksctl create iamserviceaccount \
--cluster=${clusterName} \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--role-name AmazonEKSLoadBalancerControllerRole${seed} \
--attach-policy-arn="${policyarn}" \
--override-existing-serviceaccounts \
--approve
helm repo add eks https://aws.github.io/eks-charts
helm repo update
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=${clusterName} \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controller \
--set enableShield=false \
--set enableWaf=false \
--set enableWafv2=false
echo testing
kubectl get deployment -n kube-system aws-load-balancer-controller