Skip to content

Commit

Permalink
docs: 📰 [#2. eks] aews 2주차 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinminjin authored Feb 19, 2025
1 parent 22db776 commit 6b53319
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions _posts/aews/2025-02-16-aews02.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export KUBECONFIG=~/Downloads/kubeconfig
**(2) 배포**

```bash
**eksctl create cluster -f myeks.yaml --verbose 4**
eksctl create cluster -f myeks.yaml --verbose 4
```
![Image](https://github.com/user-attachments/assets/e506d8ad-f0cb-4b77-8d66-632d5cf59845)

Expand Down Expand Up @@ -926,7 +926,7 @@ aws ec2 authorize-security-group-ingress --group-id $MNSGID --protocol '-1' --ci
- **Operator 서버 내부 IP 인바운드 규칙 추가**

```bash
aws ec2 authorize-security-group-ingress --group-id $MNSGID --protocol '-1' --cidr **172.20.1.100/32
aws ec2 authorize-security-group-ingress --group-id $MNSGID --protocol '-1' --cidr 172.20.1.100/32

# 결과**
{
Expand Down Expand Up @@ -1740,19 +1740,19 @@ default via 192.168.3.1 dev ens5 proto dhcp src 192.168.3.72 metric 1024
```bash
# 터미널 1
ssh ec2-user@$N1
**watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"**
watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"
```
```bash
# 터미널 2
ssh ec2-user@$N2
**watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"**
watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"
```
```bash
# 터미널 3
ssh ec2-user@$N3
**watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"**
watch -d "ip link | egrep 'ens|eni' ;echo;echo "[ROUTE TABLE]"; route -n | grep eni"
```
**(2) netshoot-pod 디플로이먼트 생성**
Expand All @@ -1764,7 +1764,7 @@ kind: **Deployment**
metadata:
name: netshoot-pod
spec:
**replicas: 3**
replicas: 3
selector:
matchLabels:
app: netshoot-pod
Expand All @@ -1778,7 +1778,7 @@ spec:
image: **nicolaka/netshoot**
command: ["tail"]
args: ["-f", "/dev/null"]
**terminationGracePeriodSeconds: 0**
terminationGracePeriodSeconds: 0
EOF
```
Expand Down Expand Up @@ -2214,7 +2214,7 @@ kubectl exec -it $PODNAME1 -- ping -c 1 www.google.com
### **2. 외부로 지속적 ping 테스트**
```bash
**kubectl exec -it $PODNAME1 -- ping -i 0.1** www.google.com
kubectl exec -it $PODNAME1 -- ping -i 0.1 www.google.com
```
![Image](https://github.com/user-attachments/assets/063608c2-140a-4993-bddf-566975d7eece)
Expand Down Expand Up @@ -2394,7 +2394,7 @@ watch -d 'sudo iptables -v --numeric --table nat --list AWS-SNAT-CHAIN-0; echo ;
`conntrack` 명령어로 NAT된 연결 상태 확인

```bash
**for i in $N1 $N2 $N3; do echo ">> node $i <<"; ssh ec2-user@$i sudo conntrack -L -n |grep -v '169.254.169'; echo; done**
for i in $N1 $N2 $N3; do echo ">> node $i <<"; ssh ec2-user@$i sudo conntrack -L -n |grep -v '169.254.169'; echo; done
```

✅ **출력**
Expand Down Expand Up @@ -3441,9 +3441,6 @@ EOF number: 80e-2048rget-type: ipt-facing
namespace/game-2048 created
deployment.apps/deployment-2048 created
service/service-2048 created
ingress.networking.k8s.io/ingress-2048 createdIngress는 클러스터 내부 서비스(ClusterIP, NodePort, LoadBalancer)를 외부에 HTTP/HTTPS로 노출하는 웹 프록시 역할을 함
1. 게임 파드와 Service, Ingress 배포

```
### **2. 모니터링**
Expand Down Expand Up @@ -3718,7 +3715,7 @@ kubectl logs deploy/external-dns -n kube-system -f
# 테트리스 디플로이먼트 배포
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: **Deployment**
kind: Deployment
metadata:
name: tetris
labels:
Expand All @@ -3735,15 +3732,15 @@ spec:
spec:
containers:
- name: tetris
image: **bsord/tetris**
image: bsord/tetris
---
apiVersion: v1
kind: **Service**
kind: Service
metadata:
name: tetris
annotations:
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: **ip**
service.beta.kubernetes.io/aws-load-balancer-scheme: **internet-facing**
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
#service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "80"
Expand All @@ -3754,9 +3751,10 @@ spec:
- port: 80
protocol: TCP
targetPort: 80
**type: LoadBalancer
loadBalancerClass: service.k8s.aws/nlb**
type: LoadBalancer
loadBalancerClass: service.k8s.aws/nlb
EOF

deployment.apps/tetris created
service/tetris created
```
Expand Down Expand Up @@ -4277,7 +4275,7 @@ metadata:
### **9. 부하 분산 테스트**
```bash
kubectl exec -it netshoot-pod -- zsh -c "for i in {**1..100**}; do curl -s **svc-clusterip** | grep Hostname; done | sort | uniq -c | sort -nr"
kubectl exec -it netshoot-pod -- zsh -c "for i in {1..100}; do curl -s svc-clusterip | grep Hostname; done | sort | uniq -c | sort -nr"
```
✅ **출력**
Expand Down

0 comments on commit 6b53319

Please sign in to comment.