EKS-AWS-Load-Balancer-Controller

박기원·2022년 9월 4일
0
post-thumbnail

Before Install

# eksctl install

$ curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
$ sudo mv /tmp/eksctl /usr/local/bin
$ eksctl version

# kubectl install

$ curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.21.6/2021-01-05/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin
$ source <(kubectl completion bash)
$ echo "source <(kubectl completion bash)" >> ~/.bashrc
$ kubectl version --short --client

# AWS에서 EKS 클러스터를 생성 후
# 자격증명하여 마스터로 접속

$ aws eks --region ap-northeast-2 update-kubeconfig --name <Cluster Name>

# Helm install

$ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh
$ chmod 700 get_helm.sh
$ ./get_helm.sh

AWS-Load-Balancer-Controller Install

$ eksctl utils associate-iam-oidc-provider \
--cluster <Cluster-Name> \
--approve

$ curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.3/docs/install/iam_policy.json

$ aws iam create-policy \
--policy-name AWSLoadBalancerControllerIAMPolicy \
--policy-document file://iam-policy.json

$ eksctl create iamserviceaccount --cluster=<Cluster-Name> \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--attach-policy-arn=arn:aws:iam::<Account ID>:policy/AWSLoadBalancerControllerIAMPolicy \
--override-existing-serviceaccounts \
--approve
  • AWSLoadBalancerControllerIAMPolicy를 EKS에 연결
    노드그룹 > 세부정보 > 노드 IAM 역할 ARN > AWSLoadBalancerControllerIAMPolicy > 정책 연결
$ 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=<Cluster-Name> \
--set serviceAccount.create=false \
--set image.repository=602401143452.dkr.ecr.ap-northeast-2.amazonaws.com/amazon/aws-load-balancer-controller \
--set region=<region-code> \
--set vpcId=<vpc-ID>

# aws-load-balancer-controller 설치 확인
$ kubectl get deployment -n kube-system aws-load-balancer-controller

# ## Helm으로 설치된 AWS-Load-Balancer-Controller 삭제
helm delete aws-load-balancer-controller -n kube-system
  • RUNNING AWS-Load-Balancer-Controller

  • Error
    Error from server (InternalError): error when creating "nginx-ingress.yaml": Internal error occurred: failed calling webhook "vingress.elbv2.k8s.aws": Post

kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller/crds?ref=master"`

Ref.

Step00. eksctl 설치

Step01. 클러스터에 대한 IAM OIDC 공급자 생성

Step02. AWS Load Balancer Controller 설치

0개의 댓글