티스토리 뷰
https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/
연결하려는 pod가 동일 node에 없는 경우 연결자체가 안된다.
## internaltrafficpolicy = local and pods are not in same node.
root@aks-nodepool1-23236778-vmss000002:/# iptables-save | grep -i nginx
-A KUBE-SERVICES -d 10.0.130.191/32 -p tcp -m comment --comment "default/nginx-sample-svc has no local endpoints" -j DROP
## internaltrafficpolicy = cluster
root@aks-nodepool1-23236778-vmss000002:/# iptables-save | grep -i nginx
-A KUBE-SEP-VKFWAD6C5GW7XJNY -s 10.240.0.50/32 -m comment --comment "default/nginx-sample-svc" -j KUBE-MARK-MASQ
-A KUBE-SEP-VKFWAD6C5GW7XJNY -p tcp -m comment --comment "default/nginx-sample-svc" -m tcp -j DNAT --to-destination 10.240.0.50:8080
-A KUBE-SERVICES -d 10.0.130.191/32 -p tcp -m comment --comment "default/nginx-sample-svc cluster IP" -j KUBE-SVC-JT67RD6F3OETQGP2
-A KUBE-SVC-JT67RD6F3OETQGP2 -d 10.0.130.191/32 ! -i azv+ -p tcp -m comment --comment "default/nginx-sample-svc cluster IP" -j KUBE-MARK-MASQ
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.50:8080" -j KUBE-SEP-VKFWAD6C5GW7XJNY
만약 동일 node에 통신을 하려는 두 pod가 있는 경우는
## internaltrafficpolicy = local and pods are in same node.
root@aks-nodepool1-23236778-vmss000002:/# iptables-save |grep nginx
-A KUBE-SEP-HLUNARSNCDYYPHUV -s 10.240.0.68/32 -m comment --comment "default/nginx-sample-svc" -j KUBE-MARK-MASQ
-A KUBE-SEP-HLUNARSNCDYYPHUV -p tcp -m comment --comment "default/nginx-sample-svc" -m tcp -j DNAT --to-destination 10.240.0.68:8080
-A KUBE-SERVICES -d 10.0.130.191/32 -p tcp -m comment --comment "default/nginx-sample-svc cluster IP" -j KUBE-SVL-JT67RD6F3OETQGP2
-A KUBE-SVL-JT67RD6F3OETQGP2 -d 10.0.130.191/32 ! -i azv+ -p tcp -m comment --comment "default/nginx-sample-svc cluster IP" -j KUBE-MARK-MASQ
-A KUBE-SVL-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.68:8080" -j KUBE-SEP-HLUNARSNCDYYPHUV
보통 아래와 같은 service endpoint 에 매칭되는 rule이 존재하며 nodeIP:port로 지정되어 있다.
(여기서 10.240.0.41 는 nginx-sample pod가 동작되고 있는 node이다.)
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.41:8080" -j KUBE-SEP-I4JGEQAI6S5SYXV7
실제 pod를 4개로 늘린 경우 아래와 같이 가중치가 붙는 형태로 rule이 생성된다.
(여기서 10.240.0.73 이 실제 확인중인 node의 ip이다. 즉, 동일 node는 가중치가 없고 바로 연결을 지향한다.)
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.148:8080" -m statistic --mode random --probability 0.25000000000 -j KUBE-SEP-44HLQTUCEZ7VEBKD
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.29:8080" -m statistic --mode random --probability 0.33333333349 -j KUBE-SEP-7CLJKZYKU4YYJTUQ
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.41:8080" -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-I4JGEQAI6S5SYXV7
-A KUBE-SVC-JT67RD6F3OETQGP2 -m comment --comment "default/nginx-sample-svc -> 10.240.0.73:8080" -j KUBE-SEP-PD4DNTIBFNIHTOXJ'Cloud > Kubernetes' 카테고리의 다른 글
| envoy gateway api controller (0) | 2025.11.17 |
|---|---|
| ingress-nginx (0) | 2025.07.14 |
| fluentbit with azure blob storage (0) | 2024.08.27 |
| Retina (0) | 2024.03.22 |
| kubernetes_sd_config on Prometheus (0) | 2023.06.13 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- metallb
- nginx-ingress
- jenkins
- aquasecurity
- kubernetes install
- ansible
- minikube
- azure policy
- K3S
- Terraform
- DevSecOps
- mattermost
- vmware openstack
- hashicorp boundary
- Jenkinsfile
- ceph
- kata container
- OpenStack
- macvlan
- minio
- GateKeeper
- wsl2
- open policy agent
- crashloopbackoff
- boundary ssh
- openstack backup
- Helm Chart
- kubernetes
- socket
- openstacksdk
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함
