2주차 - EKS Networking(3)(노드 내 파드 생성 갯수 제한)

728x90

노드에 파드 생성 갯수 제한

  • 사전준비 - kube-ops-view
    • 웹페이지를 통해 현재 워커 노드의 정보와 Pod의 상태 정보를 실시간으로 확인
# kube-ops-view
helm repo add geek-cookbook https://geek-cookbook.github.io/charts/
helm install kube-ops-view geek-cookbook/kube-ops-view --version 1.2.2 --set service.main.type=LoadBalancer --set env.TZ="Asia/Seoul" --namespace kube-system

# kube-ops-view 접속 URL 확인 (1.5 배율)
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"}'

  • 노드 공간 바닦에 배치된 Pod는 kube-system 네임스페이스에 배치된 Pod
  • 노드 공간 윗쪽에 배치된 Pod는 사용자가 생성한 Pod가 순차적으로 배치

 

  • AWS Instance 종류 별(워커노드) Pod 생성 갯수
    • 최대 파드 생성 갯수 : (Number of network interfaces for the instance type × (the number of IP addressess per network interface - 1)) + 2

  • 현재 실습으로 사용하고 있는 t3.medium의 경우 ENI3개를 사용 할 수 있으며, 최대 할당 가능 IP는 15

  • 워커 노드의 스펙이 올라가면 더 많은 Pod 생성 가능 - C Type 인스턴스
(yjsong@myeks:default) [root@myeks-bastion-EC2 ~]# aws ec2 describe-instance-types --filters Name=instance-type,Values=c5*.* \
>  --query "InstanceTypes[].{Type: InstanceType, MaxENI: NetworkInfo.MaximumNetworkInterfaces, IPv4addr: NetworkInfo.Ipv4AddressesPerInterface}" \
>  --output table
----------------------------------------
|         DescribeInstanceTypes        |
+----------+----------+----------------+
| IPv4addr | MaxENI   |     Type       |
+----------+----------+----------------+
|  30      |  8       |  c5d.12xlarge  |
|  10      |  3       |  c5d.large     |
|  10      |  3       |  c5n.large     |
|  30      |  8       |  c5.4xlarge    |
|  15      |  4       |  c5n.2xlarge   |
|  30      |  8       |  c5n.9xlarge   |
|  15      |  4       |  c5d.2xlarge   |
|  15      |  4       |  c5.xlarge     |
...
  • 파드 사용 가능 계산 : aws-node 와 kube-proxy 파드는 host-networking 사용으로 IP 2개 남음  / ((MaxENI * (IPv4addr-1[워커노드 자신 IP])) + 2)
    • 예시)t3.medium 경우 : ((3 * (6 - 1) + 2 ) = 17개 >> aws-node 와 kube-proxy 2개 제외하면 15개
  • 워커 노드의 상세정보를 통해서도 확인 가능
kubectl describe node | grep Allocatable: -A6
Allocatable:
  cpu:                         1930m
  ephemeral-storage:           27905944324
  hugepages-1Gi:               0
  hugepages-2Mi:               0
  memory:                      3388360Ki
  pods:                        17

 

  • 최대 파드 생성 및 확인
# 워커 노드 3대 EC2 - 모니터링
while true; do ip -br -c addr show && echo "--------------" ; date "+%Y-%m-%d %H:%M:%S" ; sleep 1; done

# 터미널1
watch -d 'kubectl get pods -o wide'

# 터미널2
## 디플로이먼트 생성
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
        ports:
        - containerPort: 80
EOF

 

 

  • Pod 생성 Test를 위하여 deployment 생성
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
        ports:
        - containerPort: 80
EOF

 

 

1. 파드 정상 생성 확인, 워커 노드에서 eth, eni 갯수 확인 kubectl scale deployment nginx-deployment --replicas=8
→ 파드 정상 생성 확인

 

2. 파드 정상 생성 확인, 워커 노드에서 eth, eni 갯수 확인 kubectl scale deployment nginx-deployment --replicas=15

→ 파드 정상 생성 확인

 

3. 파드 정상 생성 확인, 워커 노드에서 eth, eni 갯수 확인 kubectl scale deployment nginx-deployment --replicas=30
→ ENI추가 확인



4. 파드 정상 생성 확인, 워커 노드에서 eth, eni 갯수 확인 kubectl scale deployment nginx-deployment --replicas=50

→ pending Pod 확인

728x90