ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
ยฉ 2023, Amazon Web Services, Inc. or its affiliates.
์์๋๋ฉด ์ธ๋ชจ์๋ Amazon EKS
๋คํธ์ํน ํ ๋ช ๊ฐ์ง
Yongho Choi
Solutions Architect
AWS
2.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
ยฉ 2023, Amazon Web Services, Inc. or its affiliates.
Amazon EKS๋ฅผ ์ํ
๋คํธ์ํฌ ๊ตฌ์ฑ์?
3.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
์ ๊น! IP ๊ธฐ๋ณธ ์ง์
โข ์ฌ์ค IP (Private IP)๋ ๋ฌด์์ด๊ณ ์ ์ธ๊น์?
A ์คํํธ์ (192.168.0.0/16)
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
Subnet Subnet
Subnet Subnet
VPC
Availability Zone
ap-northeast-2A
Availability Zone
ap-northeast-2B
VPC ์์ฑ : ์๋ธ๋ท ์ ์ ๋ฐ IPv4 ์ฃผ์ ๋์ญ ํ ๋น
172.31.0 172.31.1
172.31.128 172.31.129
6.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
๊ฐ์ฉ์์ญ ๋ ๋ฒจ์ ๊ณ ๊ฐ์ฉ์ฑ ๊ตฌ์ฑ
โข ์ต์ 2๊ฐ ์ด์์ ๊ฐ์ฉ ์์ญ ์ฌ์ฉ ๊ถ์ฅ
AWS Cloud
Region
Availability Zone
Amazon VPC
์ธ์คํด์ค 1 ์ธ์คํด์ค 2
Availability Zone
7.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
ํผ๋ธ๋ฆญ ์๋ธ๋ท
โข ์ธํฐ๋ท๊ณผ ์๋ฐฉํฅ ํต์ ์ด ํ์ํ๊ฐ?
Amazon VPC
๊ฐ์ฉ ์์ญ ๊ฐ์ฉ ์์ญ
/16
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
/22
0.0.0.0/0 IGW
10.1.0.0/16 Local
Destination Target
8.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
ํ๋ผ์ด๋น ์๋ธ๋ท
โข ํ๋ผ์ด๋น ์๋ธ๋ท๋ ์ธํฐ๋ท๊ณผ ์์๋ฐ์ด๋ ํต์ ์ ํ์ํ๋ค๋ฉด? โ NAT
๊ฒ์ดํธ์จ์ด
Amazon VPC
๊ฐ์ฉ ์์ญ ๊ฐ์ฉ ์์ญ
/16
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
/22
0.0.0.0/0 IGW
10.1.0.0/16 Local
Destination Target
NAT ๊ฒ์ดํธ์จ์ด
EIP: 11.22.33.44
์ธ์คํด์ค B
NAT GW
0.0.0.0/0
10.1.0.0/16 Local
Destination Target
9.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
NAT ๊ฒ์ดํธ์จ์ด
โข NAT ๊ฒ์ดํธ์จ์ด ์ด์คํ ๊ตฌ์ฑ์ ํตํ ๊ฐ์ฉ ์์ญ(AZ) ์์ค์ ๊ฐ์ฉ์ฑ ํ๋ณด
Amazon VPC
๊ฐ์ฉ ์์ญ ๊ฐ์ฉ ์์ญ
/16
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
ํ๋ผ์ด๋น ์๋ธ๋ท
ํผ๋ธ๋ฆญ ์๋ธ๋ท
/22
0.0.0.0/0 IGW
10.1.0.0/16 Local
Destination Target
NAT ๊ฒ์ดํธ์จ์ด
EIP: 11.22.33.44
์ธ์คํด์ค B
NAT GW
0.0.0.0/0
10.1.0.0/16 Local
Destination Target
EIP: 11.33.44.55
10.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates. 10
๊ทธ๋ผ Amazon EKS์์๋ ์ด๋ป๊ฒ ์๋ธ๋ท์ ๊ตฌ์ฑํด์ผ ํ ๊น์?
11.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
10.0.11.0/20 10.0.12.0/20 10.0.13.0/20
AZ 1A
Amazon EKS Networking
Customer VPC 10.0.0.0/16
Amazon Managed VPC
API Server
EKS Control Plane
Data Plane
10.0.1.0/28
AZ 1B AZ 1C
10.0.2.0/28
์์ปค ๋ ธ๋๋ค์ ํ๋ผ์ด๋น ์๋ธ๋ท์ ์์ฑ
12.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates. 12
๊ทธ๋ผ ์ธ๋ถ์์ ๋ค์ด์ค๋ ํธ๋ํฝ์
์ด๋ป๊ฒ ๋ ธ๋ ๋๋ Pod๋ก ์ ๋ฌํ ๊น์?
13.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates. 13
Pod A
Pod B
Application Load Balancer
Service A -Target Group
(์ธ์คํด์ค๋ชจ๋)
Service B -Target Group
(์ธ์คํด์ค๋ชจ๋)
Service C-Target Group
(IP ๋ชจ๋)
Network Load Balancer
Pod A
Pod B Pod C
Pod A
Pod D
ALB Ingress
Controller
Pod C
Pod D
NP-
B NP-
A NP-
B NP-
A
Pod C
NP-
A
https://github.com/kubernetes-sigs/aws-load-balancer-controller
์ํ ์ ๋ฐ์ดํธ
Watch
๊ท์น: /dog ๊ท์น: /cat ๊ท์น: /pets
API Server
๋ก๋๋ฐธ๋ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ์ธ๋ถ ํธ๋ํฝ Pod๋ก ๋ถ๋ฐฐ
14.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
์๋ธ๋ท ์๋ ํ์
Private Subnet
Public Subnet
Tags:
kubernetes.io/role/elb: 1
kubernetes.io/cluster/${cluster-name}: shared*
Tags:
kubernetes.io/role/internal-elb: 1
kubernetes.io/cluster/${cluster-name}: shared*
๋ก๋ ๋ฐธ๋ฐ์๋ ์๋ธ๋ท์ ํ ๋น๋ ํ๊ทธ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์๋ธ๋ท์ ๋ฐฐ์น๋ฉ๋๋ค.
* Not needed in versions 1.19 or later
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
EKS์์ Network Load Balancer ํ๋ก๋น์ ๋
Customer VPC
Data Plane
Pod Pod
NodePort
kubectl apply โf
Cloud Controller Manager
EKS VPC
Control Plane
Service Controller
CLB/NLB
provisioning
Listener
Target Group
17.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
EKS์์ Network Load Balancer ํ๋ก๋น์ ๋
kubectl apply โf
NodePort: 31245
ClusterIP: 172.20.84.55
Port: 80
Service
Pod
10.0.1.101:8080
Pod
10.0.1.102:8080
Node1
31245
Node2
31245
EKS VPC
Control Plane
Cloud Controller Manager
Service Controller
CLB/NLB
provisioning
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
AWS Load Balancer Controller์ ์ํ Target ์ ํ ์ค์
kubectl apply โf
EKS VPC
Control Plane
Cloud Controller Manager
Service Controller
Customer VPC
Data Plane
Listener
Target Group
Pod Pod
NodePort
AWS Load
Balancer
Controller
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance
NLB provisioning
20.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
AWS Load Balancer Controller์ ์ํ Target ์ ํ ์ค์
kubectl apply โf
EKS VPC
Control Plane
Cloud Controller Manager
Service Controller
Customer VPC
Data Plane
Listener
Target Group
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
AWS Load
Balancer
Controller
NLB provisioning
Pod Pod
21.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
AWS Load
Balancer
Controller
AWS Load Balancer Controller์ ์ํ Target ์ ํ ์ค์
kubectl apply โf
EKS VPC
Control Plane
Cloud Controller Manager
Service Controller
Customer VPC
Data Plane
Pod1
10.0.1.101:8080
Pod2
10.0.1.102:8080
NLB provisioning
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
AWS Load
Balancer
Controller
Ingress Rule์ ์ฌ์ฉํ์ฌ ๋์ ์๋น์ค๋ก ๋ผ์ฐํ
kubectl apply โf
EKS VPC
Control Plane
Customer VPC
Data Plane
Listener
Target Group
Echo Pod Echo Pod
ALB provisioning
Ingress Rules
24.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
AWS Load
Balancer
Controller
IngressGroup์ผ๋ก ์ฌ๋ฌ Ingress ๋ฆฌ์์ค๋ฅผ ๋จ์ผ ALB๋ก ๊ฒฐํฉ
kubectl apply โf
Application
Load balancer
provisioning
EKS VPC
Control Plane
Customer VPC
Data Plane
Listener
Target Group 2
App1 Pod App1 Pod
App2 Pod App2 Pod
Target Group 1
alb.ingress.kubernetes.io/group.name: web-services
Ingress Rules
(App1)
Ingress Rules
(App2)
25.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
ยฉ 2023, Amazon Web Services, Inc. or its affiliates.
DNS ์ฑ๋ฅ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด?
26.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
How DNS Works in Kubernetes
VPC
10.0.0.0/16
Route 53
Resolver
10.0.0.2
Upstream DNS
Name Server
โข CoreDNS add-on์ EKS ํด๋ฌ์คํฐ ๋ด์์
๋ฆฌ์์ค๋ค์ DNS๋ช ์ ํ์ธ(resolve)ํจ
โข VPC ์ฉ ๊ธฐ๋ณธ Route 53 Resolver๋ VPC
๋ด์์ ํด๋ฌ์คํฐ ์ธ๋ถ์ ์๋ ๋ฆฌ์์ค๋ฅผ
ํ์ธํจ
โข VPC ๋ด๋ถ์์ ์ฐพ์ ์ ์๋ค๋ฉด ์ธ๋ถ
๋ฆฌ์์ค๋ฅผ ํ์ธํ๊ธฐ ์ํด ์ ์คํธ๋ฆผ DNS
name server๋ก ์์ฒญ
27.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
How CoreDNS Works
nameserver 10.100.0.10
search default.svc.cluster.local svc.cluster.local cluster.local us-west-2.compute.internal
options ndots:5
๊ฐ ์ปจํ ์ด๋๋ค์ Kubelet์ ์ํด /etc/resolv.conf ๋ฅผ ์์ ๋ฐ์
Lookup DNS Name
Is this a FQDN?
CoreDNS
ClusterIP: 10.100.0.10
Yes
No
Query with FQDN
Query with each search domain as suffix
Upstream
Resolver
getaddrinfo
syscall
28.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
How CoreDNS Works
nameserver 10.100.0.10
search default.svc.cluster.local svc.cluster.local cluster.local us-west-2.compute.internal
options ndots:5
Lookup aws.com.
Is this a FQDN?
CoreDNS
ClusterIP: 10.100.0.10
Yes
Query with aws.com.
์ (.)์ผ๋ก ๋๋ฌ๊ธฐ ๋๋ฌธ์ FQDN์ผ๋ก ์ฒ๋ฆฌ๋จ
๊ฐ ์ปจํ ์ด๋๋ค์ Kubelet์ ์ํด /etc/resolv.conf ๋ฅผ ์์ ๋ฐ์
29.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
How CoreDNS Works
nameserver 10.100.0.10
search default.svc.cluster.local svc.cluster.local cluster.local us-west-2.compute.internal
options ndots:5
Lookup ABC123.gr7.us-west-2.eks.amazonaws.com
Is this a FQDN?
CoreDNS
ClusterIP: 10.100.0.10
Yes
Query with ABC123.gr7.us-west-2.eks.amazonaws.com
5๊ฐ์ ์ (.)์ ํฌํจ
๊ฐ ์ปจํ ์ด๋๋ค์ Kubelet์ ์ํด /etc/resolv.conf ๋ฅผ ์์ ๋ฐ์
30.
ยฉ 2023, AmazonWeb Services, Inc. or its affiliates.
app.nodejs.svc.default.svc.cluster.local.
app.nodejs.svc.svc.cluster.local.
app.nodejs.svc.cluster.local.
app.nodejs.svc.us-west-2.compute.internal.
app.nodejs.svc.
How CoreDNS Works
nameserver 10.100.0.10
search default.svc.cluster.local svc.cluster.local cluster.local us-west-2.compute.internal
options ndots:5
No
Lookup app.nodejs.svc
Is this a FQDN?
CoreDNS
ClusterIP: 10.100.0.10
Query
with
5๊ฐ๋ณด๋ค ์ (.)์ด ๋ถ์กฑ
๊ฐ ์ปจํ ์ด๋๋ค์ Kubelet์ ์ํด /etc/resolv.conf ๋ฅผ ์์ ๋ฐ์