작성
·
576
2
환경 : aws ec2 / centos 7.9 / v1.22.0
영상보고 pod-1 생성은 된거 같습니다. 그런데 curl 명령 실행시 응답이 없습니다.
[root@k8s-master ~]# kubectl get pods -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
calico-system calico-kube-controllers-8fdfc695-69ch4 1/1 Running 1 (4m11s ago) 100m 20.108.82.200 k8s-master <none> <none>
calico-system calico-node-84fcs 1/1 Running 1 (4m11s ago) 100m 192.168.56.30 k8s-master <none> <none>
calico-system calico-node-pqfwm 1/1 Running 0 98m 192.168.56.31 k8s-node1 <none> <none>
calico-system calico-node-tt922 1/1 Running 0 98m 192.168.56.32 k8s-node2 <none> <none>
calico-system calico-typha-c477bcd79-2fv8g 1/1 Running 1 (4m4s ago) 100m 192.168.56.30 k8s-master <none> <none>
calico-system calico-typha-c477bcd79-6xgkn 1/1 Running 0 98m 192.168.56.31 k8s-node1 <none> <none>
calico-system csi-node-driver-4lght 2/2 Running 0 98m 20.111.156.65 k8s-node1 <none> <none>
calico-system csi-node-driver-pj7zm 2/2 Running 0 97m 20.109.131.1 k8s-node2 <none> <none>
calico-system csi-node-driver-vzfdn 2/2 Running 2 (4m11s ago) 100m 20.108.82.203 k8s-master <none> <none>
default pod-1 2/2 Running 0 41m 20.109.131.2 k8s-node2 <none> <none>
kube-system coredns-78fcd69978-ncl62 1/1 Running 26 (5m19s ago) 110m 20.108.82.199 k8s-master <none> <none>
kube-system coredns-78fcd69978-zdvl2 1/1 Running 1 (4m6s ago) 110m 20.108.82.201 k8s-master <none> <none>
kube-system etcd-k8s-master 1/1 Running 1 (4m11s ago) 111m 192.168.56.30 k8s-master <none> <none>
kube-system kube-apiserver-k8s-master 1/1 Running 1 (4m1s ago) 111m 192.168.56.30 k8s-master <none> <none>
kube-system kube-controller-manager-k8s-master 1/1 Running 1 (4m11s ago) 111m 192.168.56.30 k8s-master <none> <none>
kube-system kube-proxy-m82wz 1/1 Running 1 (4m11s ago) 110m 192.168.56.30 k8s-master <none> <none>
kube-system kube-proxy-qmhcv 1/1 Running 0 98m 192.168.56.31 k8s-node1 <none> <none>
kube-system kube-proxy-vsh5v 1/1 Running 0 98m 192.168.56.32 k8s-node2 <none> <none>
kube-system kube-scheduler-k8s-master 1/1 Running 1 (4m11s ago) 111m 192.168.56.30 k8s-master <none> <none>
kubernetes-dashboard dashboard-metrics-scraper-856586f554-qwmzq 1/1 Running 1 (4m11s ago) 99m 20.108.82.198 k8s-master <none> <none>
kubernetes-dashboard kubernetes-dashboard-5949b5c856-ql8vx 1/1 Running 1 (4m11s ago) 99m 20.108.82.202 k8s-master <none> <none>
tigera-operator tigera-operator-cffd8458f-8z85v 1/1 Running 1 (4m11s ago) 100m 192.168.56.30 k8s-master <none> <none>
[root@k8s-master ~]# curl 20.109.131.2:8000
^C
[root@k8s-master ~]#
[root@k8s-master ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.56.1 0.0.0.0 UG 0 0 0 eth0
20.108.82.192 0.0.0.0 255.255.255.192 U 0 0 0 *
20.108.82.198 0.0.0.0 255.255.255.255 UH 0 0 0 cali6c5795e996a
20.108.82.199 0.0.0.0 255.255.255.255 UH 0 0 0 cali054099bed35
20.108.82.200 0.0.0.0 255.255.255.255 UH 0 0 0 cali7b0ee01ff08
20.108.82.201 0.0.0.0 255.255.255.255 UH 0 0 0 cali2d518c9126c
20.108.82.202 0.0.0.0 255.255.255.255 UH 0 0 0 calib55986b3261
20.108.82.203 0.0.0.0 255.255.255.255 UH 0 0 0 cali1dae5a2bc74
20.109.131.0 192.168.56.32 255.255.255.192 UG 0 0 0 eth0
20.111.156.64 192.168.56.31 255.255.255.192 UG 0 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
[root@k8s-master ~]#
AWS SG에는 ec2간 tcp,udp는 모두 허용했구요.
20.0.0.0/8 대역도 tcp,udp 통신 모두 허용했습니다.
어느부분을 더 확인해봐야 할까요?
답변 1
0
Pod가 node2에 있으면 한번 node2에서 curl을 해보시겠어요?
검색해보니 aws에서는 calilco 설치를 다르게 해야 합니다.
https://kim-dragon.tistory.com/166
근데 제 강의에서는 편의를 위해 VM에서 Pod나 Service IP로 curl을 날렸지만
정상적인 사용 상으로는 VM에서 Pod나 Service로 IP를 날리지 않습니다.
Pod IP는 클러스터 내에서만 사용을 하기 때문에 통상 A Pod에서 B Pod IP로 curl을 보내야 되는거죠.
외부에서 Pod로 통신을 하려면, NodePort 타입에 Service를 이용해서 통신을 해야하긴 해서
VM에서 Pod IP로의 호출이 안되는게 비정상적인 동작은 아닙니다.