Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

클라우드 엔지니어 꿈나무

Kubernetes Pod Networking - Centos7 본문

kubernetes

Kubernetes Pod Networking - Centos7

새싹싹이 2023. 9. 22. 16:58

Pod 통신

CNI(Container Network Interface*) 이용 - Weave

*CNI: 컨테이너 기반 오케스트레이션 시스템에서 컨테이너 네트워크를 관리하고 설정하기 위한 표준 인터페이스

yum install -y traceroute

 

ip address

vi alpine.yml

node1과 node2에 각각 al1과 al2를 생성

apiVersion: v1
kind: Pod
metadata:
  name: al1
spec:
  containers:
  - name: alpine1
    image: alpine
    imagePullPolicy: IfNotPresent
    command: ["/bin/sh", "-c", "while true; do sleep 1000; done"]
  nodeName: node1
---
apiVersion: v1
kind: Pod
metadata:
  name: al2
spec:
  containers:
  - name:  alpine2
    image: alpine
    imagePullPolicy: IfNotPresent
    command: ["/bin/sh", "-c", "while true; do sleep 1000; done"]
  nodeName: node2

kubectl apply -f alpine.yml

kubectl exec al1 -it -- bash : Pod 진입하여 node 2와 ping 

<참고>

kubectl exec al1 -it -- sh : alpine은 shell만

kubectl exec c1 -it -- sh /  kubectl exec c1 -it -- bash : centos는 shell과 bash 둘 다 실행 가능

Master

kubectl exec al1 -it --sh : pod 진입 후, traceroute 실행

traceroute 10.36.0.2 와 traceroute 8.8.8.8 비교

- 10.36.0.2와는 동일 스위치 내 host 간의 통신과 같이 라우팅 경로가 표시되지 않음.

ifconfig 내 ip 확인

route -n 으로 gateway 주소 확인

10번 vxlan 기준으로 그 이전에는 내부적인 연결

pod 내, 25와 if26이 연결된 것을 확인 -> node1 내 26과 if25가 연결이 된 것이 확인 가능