Ingress Controller
Ingress ๋ฆฌ์์ค๊ฐ ์๋ ํ๋ ค๋ฉด ํด๋ฌ์คํฐ์ Ingress ์ปจํธ๋กค๋ฌ๊ฐ ์คํ ์ค ์ด์ด์ผ ํฉ๋๋ค.
kube-controller-manager
๋ฐ์ด๋๋ฆฌ ์ผ๋ถ๋ก ์คํ๋๋ ๋ค๋ฅธ ์ ํ์ ์ปจํธ๋กค๋ฌ์ ๋ฌ๋ฆฌ Ingress ์ปจํธ๋กค๋ฌ๋ ํด๋ฌ์คํฐ์ ํจ๊ป ์๋์ผ๋ก ์์๋์ง ์์ต๋๋ค.
AWS Load Balancer Controller
AWS Load Balancer Controller๋ ์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ์ฉ Elastic Load Balancer๋ฅผ ๊ด๋ฆฌํ๋ ๋ฐ ๋์์ด ๋๋ controller ์ ๋๋ค.
Application Load Balancers๋ฅผ ํ๋ก๋น์ ๋ํ์ฌ ์ฟ ๋ฒ๋คํฐ์ค
Ingress
๋ฆฌ์์ค๋ฅผ ์ถฉ์กฑ ํฉ๋๋ค.Network Load Balancers๋ฅผ ํ๋ก๋น์ ๋ํ์ฌ ์ฟ ๋ฒ๋คํฐ์ค
Service
๋ฆฌ์์ค๋ฅผ ์ถฉ์กฑ ํฉ๋๋ค.
AWS Load Balancer ์ปจํธ๋กค๋ฌ์์ ์ง์ํ๋ ํธ๋ํฝ ๋ชจ๋๋ ์๋์ ๋ ๊ฐ์ง์ ๋๋ค.
Instance(default): ํด๋ฌ์คํฐ ๋ด ๋ ธ๋๋ฅผ ALB์ ๋์์ผ๋ก ๋ฑ๋กํฉ๋๋ค. ALB์ ๋๋ฌํ๋ ํธ๋ํฝ์ NodePort๋ก ๋ผ์ฐํ ๋ ๋ค์ ํ๋๋ก ํ๋ก์๋ฉ๋๋ค.
IP: ํ๋๋ฅผ ALB ๋์์ผ๋ก ๋ฑ๋กํฉ๋๋ค. ALB์ ๋๋ฌํ๋ ํธ๋ํฝ์ ํ๋๋ก ์ง์ ๋ผ์ฐํ ๋ฉ๋๋ค. ํด๋น ํธ๋ํฝ ๋ชจ๋๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด์ ingress.yaml ํ์ผ์ ์ฃผ์์ ์ฌ์ฉํ์ฌ ๋ช ์์ ์ผ๋ก ์ง์ ํด์ผ ํฉ๋๋ค.
์ด๋ฒ ์ค์ต์์๋ Application Load Balancer์ ์ด์ ์ ๋ง์ถ ๊ฒ์ ๋๋ค.
AWS Elastic Load Balancing Application Load Balancer (ALB)๋ ์ฌ๋ฌ ๊ฐ์ฉ ์์ญ์์ Amazon EC2 ์ธ์คํด์ค์ ๊ฐ์ ์ฌ๋ฌ ๋์์ ๊ฑธ์ณ ์ ํ๋ฆฌ์ผ์ด์ ๊ณ์ธต์์ ์์ ํธ๋ํฝ์ ๋ก๋ ๋ฐธ๋ฐ์ฑํ๋ ์ ์๋ ค์ง AWS ์๋น์ค์ ๋๋ค.
ALB๋ ๋ค์์ ํฌํจํ ์ฌ๋ฌ ๊ธฐ๋ฅ์ ์ง์ ํฉ๋๋ค.
ํธ์คํธ ๋๋ ๊ฒฝ๋ก ๊ธฐ๋ฐ ๋ผ์ฐํ
TLS (Transport Layer Security) ํฐ๋ฏธ๋ค์ด์ , WebSocket
HTTP / 2
AWS WAF(Web Application Firewall) ํตํฉ
ํตํฉ ์ก์ธ์ค ๋ก๊ทธ ๋ฐ ์ํ ํ์ธ
1. AWS Load Balancer Controller ๋ฐฐํฌํ๊ธฐ
๋จผ์ AWS Load Balancer Controller ๋ฒ์ ์ด ์ค์ ๋์๋์ง ํ์ธ ํฉ๋๋ค.
if [ ! -x ${LBC_VERSION} ]
then
tput setaf 2; echo '${LBC_VERSION} has been set.'
else
tput setaf 1;echo '${LBC_VERSION} has NOT been set.'
fi
๊ฒฐ๊ณผ์์ ${LBC_VERSION}์ด ์ค์ ๋์ง ์์ ๊ฒฝ์ฐ ์ฌ๊ธฐ๋ฅผ ํด๋ฆญํ์ฌ ์ง์นจ์ ํ์ธํ์ญ์์ค.
Helm์ ์ฌ์ฉํ์ฌ ALB Ingress Controller๋ฅผ ์ค์น ํฉ๋๋ค.
๋จผ์ helm
์ด ์ค์น๋์ด ์๋์ง ํ์ธ ํ์ญ์์ค:
helm version --short
๋ง์ฝ helm์ด ์ค์น๋์ด ์์ง ์๋ค๋ฉด, ์ฌ๊ธฐ๋ฅผ ์ฐธ๊ณ ํ์ฌ ์ค์นํฉ๋๋ค.
ํด๋ฌ์คํฐ์ ๋ํ IAM OIDC provider ์์ฑํฉ๋๋ค. Pod์ ๊ฐ์ ํด๋ฌ์คํฐ ๋ด ์ฟ ๋ฒ๋คํฐ์ค๊ฐ ์์ฑํ ํญ๋ชฉ์ด API Server ๋๋ ์ธ๋ถ ์๋น์ค์ ์ธ์ฆํ๋๋ฐ ์ฌ์ฉ๋๋ service account์ IAM role์ ์ฌ์ฉํ๊ธฐ ์ํด, ์์ฑํ ํด๋ฌ์คํฐ(ํ์ฌ ์ค์ต์์์ eks-demo)์ IAM OIDC provider๊ฐ ์กด์ฌํด์ผ ํฉ๋๋ค.
eksctl utils associate-iam-oidc-provider \
--region ${AWS_REGION} \
--cluster eksworkshop-eksctl \
--approve
Amazon EKS ์ค๋ช ์์์ ์๋น์ค ๊ณ์ ์ IAM Roles for Service Accounts์ ๋ํด ์์ธํ ์์๋ณด์ญ์์ค.
AWS Load Balancer Controller์ ๋ถ์ฌํ AWSLoadBalancerControllerIAMPolicy ์ ์ฑ ์ ์์ฑํฉ๋๋ค.
curl -o iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.3.0/docs/install/iam_policy.json
aws iam create-policy \
--policy-name AWSLoadBalancerControllerIAMPolicy \
--policy-document file://iam_policy.json
AWS Load Balancer Controller๋ฅผ ์ํ ServiceAccount๋ฅผ ์์ฑํฉ๋๋ค. Account ID๊ฐ ์ค์ ๋์ด ์์ง ์๋ค๋ฉด ๋ค์์ ๋ช ๋ น์ ์คํํ ํ IAM ์ญํ ์ ์์ฑํฉ๋๋ค.
ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account)
eksctl create iamserviceaccount \
--cluster eksworkshop-eksctl \
--namespace kube-system \
--name aws-load-balancer-controller \
--attach-policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/AWSLoadBalancerControllerIAMPolicy \
--override-existing-serviceaccounts \
--approve
TargetGroupBinding CRDs ์ค์นํฉ๋๋ค.
kubectl apply -k github.com/aws/eks-charts/stable/aws-load-balancer-controller/crds?ref=master
kubectl get crd
EKS repo๋ก ๋ถํฐ helm ์ฐจํธ(AWS Load Balancer Controller)๋ฅผ ๋ฐฐํฌํฉ๋๋ค.
helm repo add eks https://aws.github.io/eks-charts
helm upgrade -i aws-load-balancer-controller \
eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=eksworkshop-eksctl \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controller \
--set image.tag="${LBC_VERSION}"
kubectl -n kube-system rollout status deployment aws-load-balancer-controller
๋ฐฐํฌ๊ฐ ์ฑ๊ณต์ ์ผ๋ก ๋๊ณ ์ปจํธ๋กค๋ฌ๊ฐ ์คํ๋๋์ง ์๋์ ๋ช ๋ น์ด๋ฅผ ํตํด ํ์ธํฉ๋๋ค.
kubectl get deployment -n kube-system aws-load-balancer-controller

Last updated
Was this helpful?