25๋ ๋ AWS EKS Hands-on Study ์คํฐ๋ ์ ๋ฆฌ ๋ด์ฉ์ ๋๋ค.
์ต๋ ํ๋ ๊ฐฏ์
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
# ์ ์ ๋งํฌ ํ์ธ
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"}
KubeOps๋ ์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ์ ๋ฆฌ์์ค๋ฅผ ์๊ฐ์ ์ผ๋ก ๊ด๋ฆฌํ ์ ์๋ ๋์๋ณด๋์ด๋ค.
๋ ํ๋ฆฌ์นด๋ฅผ ๋์ฌ์ ๋ฐฐํฌํ ์๋ก ํ๋ฉด์ ํ๋ คํ ํจ๊ณผ์ ํจ๊ป ๋ค๋ชจ(ํ๋)๊ฐ ์ถ๊ฐ๋๋ค.
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 |
+----------+----------+--------------+
| 15 | 4 | t3.xlarge |
| 15 | 4 | t3.2xlarge |
| 12 | 3 | t3.large |
| 6 | 3 | t3.medium |
| 2 | 2 | t3.nano |
| 2 | 2 | t3.micro |
| 4 | 3 | t3.small |
+----------+----------+--------------+
aws vpc cni๋ ํ๋๊ฐ ec2์ eni ip๋ฅผ ํ ๋น๋ฐ๋๋ก ๋์ํ๋ค. ๊ฐ ์ธ์คํด์ค ๋ณ๋ก ์ต๋ eni ๊ฐ์์ eni ๊ฐ ํ ๋นํ ์ ์๋ ip ๊ฐ์๊ฐ ์ ํด์ ธ ์๋๋ฐ ์ ๋ช ๋ น์ด๋ฅผ ํตํด ์ด ๊ฐ์ ํ์ธํ ์ ์๋ค.
์ค์ต์์ ์ฌ์ฉํ ์์ปค ๋ ธ๋๋ t3.medium ํ์ ์ด๋ค.
- ๋ ์นด๋๋ฅผ 3๊ฐ๋ฅผ ์ต๋๋ก ๊ฐ์ง ์ ์๋ค.
- eni ๋น ํ ๋น ๊ฐ๋ฅํ ์ฌ์ฉ ๊ฐ๋ฅํ ip ๊ฐ์ : 6 (ํ๋ผ์ด๋จธ๋ฆฌ 1๊ฐ + ์ธ์ปจ๋๋ฆฌ 5๊ฐ)
- ์ ์ฒด ์ฌ์ฉ ๊ฐ๋ฅํ ip ๊ฐ์ : 6*3=18
- ํ๋์ ํ ๋น ๊ฐ๋ฅํ ip ๊ฐ์ : 17 (๋ ธ๋๊ฐ 1๊ฐ ์ฌ์ฉ)
์ฆ t3.medium ํ์ ์ ์ธ์คํด์ค์์๋ ์ต๋ ํ๋๋ฅผ 17๊ฐ ๋์ธ ์ ์๋ ๊ฒ์ ์ ์ ์๋ค. ํ์ง๋ง aws ๊ธฐ๋ณธ ํ๋๋ฅผ ์ ์ธํ๋ฉด ์ฌ์ฉ์๊ฐ ๋์ธ ์ ์๋ ํ๋๋ 15๊ฐ์ด๋ค.
kubectl scale deployment nginx-deployment --replicas=8
kubectl scale deployment nginx-deployment --replicas=15
kubectl scale deployment nginx-deployment --replicas=30
kubectl scale deployment nginx-deployment --replicas=50
ํ์ฌ ์ฌ์ฉ ์ค์ธ EC2 ์ธ์คํด์ค๋ t3.medium์ธ๋ฐ, ์ด ์ธ์คํด์ค๋ ๊ฐ eni ๋น 5๊ฐ์ ์ถ๊ฐ IP๋ฅผ ํ ๋นํ ์ ์์ผ๋ฉฐ, ์ต๋ 3๊ฐ์ eni๋ฅผ ๊ฐ์ง ์ ์๋ค.
kubectl get pod -o wide | grep Pending
nginx-deployment-6c8cb99bb9-6pdcl 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-9pt62 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-dlx6v 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-fgc8x 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-kf6bl 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-kg7xh 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-nptcc 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-vb5ss 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-wr8ff 0/1 Pending 0 6m46s <none> <none> <none> <none>
nginx-deployment-6c8cb99bb9-zhb86 0/1 Pending 0 6m46s <none> <none> <none> <none>
๋ ํ๋ฆฌ์นด๋ฅผ 50์ผ๋ก ์ค์ ํ๊ฒ ๋๋ฉด ec2์ ํ ๋น ๊ฐ๋ฅํ ip ๊ฐ์๋ฅผ ์ด๊ณผํ๋ฏ๋ก 10๊ฐ์ ํ๋๋ค์ Pending ์ํ๋ก ๋จ์ ํ์ธํ ์ ์๋ค.