본문 바로가기
AWS/EKS

[AEWS2] 2-2. 파드 생성 개수 제한하기

by okms1017 2024. 3. 16.
728x90

✍ Posted by Immersive Builder  Seong

 

1. 리소스 시각화 

kube-ops-view

kube-ops-view는 Worker Node의 파드 상태 정보를 실시간으로 보여주는 웹 기반 시각화 도구입니다. 

 

# Helm 구성
$ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
$ helm version --short
v3.14.3+gf03cc04

# Helm 저장소 추가 
$ helm repo add geek-cookbook https://geek-cookbook.github.io/charts/
$ helm repo list
NAME            URL
geek-cookbook   https://geek-cookbook.github.io/charts/

# kube-ops-view 설치
$ helm install kube-ops-view geek-cookbook/kube-ops-view --version 1.2.2 --set env.TZ="Asia/Seoul" --namespace kube-system
NAME: kube-ops-view
LAST DEPLOYED: Sat Mar 16 16:15:24 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
$ k get pod -A | grep kube-ops-view
kube-system   kube-ops-view-9cc4bf44c-cs292   1/1     Running   0          13m
$ kubectl patch svc -n kube-system kube-ops-view -p '{"spec":{"type":"LoadBalancer"}}'
service/kube-ops-view patched

# kube-ops-view URL
$ kubectl get svc -n kube-system kube-ops-view -o jsonpath={.status.loadBalancer.ingress[0].hostname} | awk '{ print "KUBE-OPS-VIEW URL = http://"$1":8080/#scale=1.5"}'
KUBE-OPS-VIEW URL = http://aa4f17948a1384f789a90ea0e1fac7a8-1226237499.ap-northeast-2.elb.amazonaws.com:8080/#scale=1.5

 

하단에는 kube-system 네임스페이스에 존재하는 파드가 출력되고,

상단에는 그 외 나머지 네임스페이스에 존재하는 파드가 출력됩니다. 

 

kube-ops-view

 


2. 파드 생성 개수 제한 

Secondary IPv4 addresses

인스턴스 유형에 따라 할당 가능한 ENI 개수와 ENI에 할당 가능한 Secondary IP 개수 제한이 있습니다. 

즉, ENI 개수와 Secondary IP 개수를 조합하여 최대 파드 개수를 선정하는 방식입니다. 

 

* 최대 파드 개수 = 인스턴스 유형별 ENIs * Secondary IPs + 2   

  ENIs Secondary IPs 최대 할당 가능한 IPs 최대 생성 가능한 Pods
t3.medium 3 5 15 17 (aws-node, kube-proxy 포함)
c5.large 3 9 27 29 (aws-node, kube-proxy 포함)

 

# t3 Instance type 
# How to change Instanc type: Values=t3.* -> Values=c5*.*
$ aws ec2 describe-instance-types --filters Name=instance-type,Values=t3.* \
 --query "InstanceTypes[].{Type: InstanceType, MaxENI: NetworkInfo.MaximumNetworkInterfaces, \
 IPv4addr: NetworkInfo.Ipv4AddressesPerInterface}" --output table
--------------------------------------
|        DescribeInstanceTypes       |
+----------+----------+--------------+
| IPv4addr | MaxENI   |    Type      |
+----------+----------+--------------+
|  6       |  3       |  t3.medium   |
|  15      |  4       |  t3.2xlarge  |
|  15      |  4       |  t3.xlarge   |
|  12      |  3       |  t3.large    |
|  2       |  2       |  t3.nano     |
|  2       |  2       |  t3.micro    |
|  4       |  3       |  t3.small    |
+----------+----------+--------------+

# Nodes Info - Allocatable: pods: 17
$ kubectl describe node | grep Allocatable: -A6
Allocatable:
  cpu:                1930m
  ephemeral-storage:  27905944324
  hugepages-1Gi:      0
  hugepages-2Mi:      0
  memory:             3388352Ki
  pods:               17

 

파드의 수량을 늘리면서 파드 상태와 네트워크 구성 변화를 모니터링합니다. 

 

* 파드 수량 = 8 

추가 생성된 파드 수만큼 veth 인터페이스가 생성됨을 확인할 수 있습니다. 

 

 

* 파드 수량 = 15

Worker Node마다 ENI(eth2)가 추가 생성되고 Secondary IP Pool 수를 15개 확보함을 확인할 수 있습니다. 

 

 

* 파드 수량 = 30

t3.medium 인스턴스의 ENI 최대 수는 3개이며, 미리 확보한 Secondary IP Pool에서 파드에 IP를 할당합니다. 

 

 

* 파드 수량 = 50

Worker Node에 더이상 여유 공간이 없어 생성에 실패한 8개의 파드들은 Pending 상태에 빠지게 됩니다. 

 

 

# 파드 생성 실패(Pending)
$ kubectl get pods | grep Pending         nginx-deployment-f7f5c78c5-74nnz   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-98tgv   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-fcx8h   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-fh8vm   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-jcxdc   0/1     Pending   0          5m37s
nginx-deployment-f7f5c78c5-k4r86   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-vhg72   0/1     Pending   0          5m38s
nginx-deployment-f7f5c78c5-xwnk7   0/1     Pending   0          5m38s

$ kubectl describe pod nginx-deployment-f7f5c78c5-74nnz | grep Events: -A5
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  23s (x2 over 5m50s)  default-scheduler  0/3 nodes are available: 3 Too many pods. preemption: 0/3 nodes are available: 3 No preemption victims found for incoming pod..

 

IPv4 Prefix Delegation 

Secondary IP에 하나의 IP 주소가 아닌 IPv4 28bit Subnet(/28-prefix)을 위임하여 최대 생성 가능한 파드 개수를 늘리는 방식입니다. ex) 192.168.2.17/32(1:1) → 192.168.2.17/28(1:16) 

 

* 최대 파드 개수 = 인스턴스 유형별 ENIs * Secondary IPs * 16 

  ENIs Secondary IPs 최대 할당 가능한 IPs 최대 생성 가능한 Pods
c5.large 3 144 432 432

 

* 제약사항 

- Nitro System 인스턴스 유형만 지원합니다. ex) A1, M5, C5, R5 

- vCPU 수에 따라 생성할 수 있는 파드의 개수가 110 ~ 250개로 제한됩니다. 

- vCPU 수가 30 미만인 인스턴스의 경우 최대 파드 개수는 110개이고, 나머지 모든 인스턴스의 경우 250개입니다. 

 

따라서, c5.large 인스턴스에서 생성 가능한 최대 파드 개수는 432개가 아닌 110개가 됩니다. 

 

Custom Networking 

Worker Node와 파드의 네트워크 대역을 분리하여 파드에 별도의 서브넷을 부여하여 사용하는 방식입니다. 

 

 


[출처] 

1) https://catalog.us-east-1.prod.workshops.aws/workshops/9c0aa9ab-90a9-44a6-abe1-8dff360ae428/ko-KR/100-scaling/300-kube-ops-view

 

Amazon EKS web application workshop

Building simple web application using Amazon EKS. This workshop covers from creating eks cluster to application's life cycle.

catalog.us-east-1.prod.workshops.aws

2) https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/using-eni.html

 

탄력적 네트워크 인터페이스 - Amazon Elastic Compute Cloud

이 페이지에 작업이 필요하다는 점을 알려 주셔서 감사합니다. 실망시켜 드려 죄송합니다. 잠깐 시간을 내어 설명서를 향상시킬 수 있는 방법에 대해 말씀해 주십시오.

docs.aws.amazon.com

3) https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances

 

인스턴스 유형 - Amazon Elastic Compute Cloud

인스턴스 유형 인스턴스를 시작할 때 지정하는 인스턴스 유형에 따라 인스턴스에 사용되는 호스트 컴퓨터의 하드웨어가 결정됩니다. 각 인스턴스 유형은 서로 다른 컴퓨팅, 메모리, 스토리지

docs.aws.amazon.com

4) https://docs.aws.amazon.com/ko_kr/eks/latest/userguide/cni-increase-ip-addresses.html

 

Amazon EC2 노드에 사용 가능한 IP 주소 증량 - Amazon EKS

관리형 노드 그룹은 maxPods의 값에 최대 수를 적용합니다. vCPU가 30개 미만인 인스턴스의 경우 최대 수는 110이고 다른 모든 인스턴스의 경우 최대 수는 250입니다. 이 최대 수는 접두사 위임의 활성

docs.aws.amazon.com

5) https://www.eksworkshop.com/docs/networking/vpc-cni/prefix/

 

Prefix Delegation | EKS Workshop

{{% required-time %}}

www.eksworkshop.com

6) https://www.eksworkshop.com/docs/networking/vpc-cni/custom-networking/

 

Custom Networking | EKS Workshop

{{% required-time estimatedLabExecutionTimeMinutes="10" %}}

www.eksworkshop.com

728x90

'AWS > EKS' 카테고리의 다른 글

[AEWS2] 2-4. Ingress & External DNS  (4) 2024.03.17
[AEWS2] 2-3. Service & AWS LoadBalancer Controller  (2) 2024.03.16
[AEWS2] 2-1. AWS VPC CNI 소개  (0) 2024.03.16
[AEWS2] 1-2. Amazon EKS 배포  (0) 2024.03.09
[AEWS2] 1-1. Amazon EKS 소개  (0) 2024.03.09