13. トラフィックの負荷分散
GKE (k8s) の Service リソースを使う
Type は LoadBalancer を指定
● 外部 LB として、GCP の External TCP/UDP
Network Load Balancing が利用される
● Proxy はせず、送信元 IP アドレスが
維持される
● 送信元 IP とポートと、宛先 IP とポート、
プロトコルのハッシュに基づいて
バランシングを行う
External Traffic
14. Pod
kube-proxy(iptables)
Pod Pod Pod Pod Pod
NIC NIC NIC
① : External TCP/UDP Network Load
Balancing がトラフィックを受信
② : 宛先 IP / Port は変えずにNode の
いずれかにバランシングしつつ転送
③ : kube-proxy(iptables) に転送
④ : kube-proxy(iptables) から 青 Pod
のいずれかにバランシングしつつ転送
①
②
③
④
Nodes
:8080 :8080 :8080
トラフィックの負荷分散イメージ
34.69.XX.XX:80External TCP/UDP Network
Load Balancing
External Traffic
LB からの Health Check は
各ノードのkube-proxy の
/healthz に対して
TCP 10256 で行っている
iptables のバランシング
アルゴリズムはRandom
18. トラフィックの負荷分散イメージ
Pod
kube-proxy(iptables)
Pod Pod Pod Pod Pod
NIC NIC NIC
Health check は
各 NodePort 宛に
行われる
:50000 :50000
NodePort: *:30080
① : External HTTP(S) Load Balancing が
トラフィックを受信
② : Path 毎に指定されたService の NodePort
に転送
③ : NodePort から kube-proxy(iptables) へ
転送
④ : kube-proxy(iptables) から
各 Pod にバランシングして転送
②
③
④
NodePort: *:30180
:8080:8080:8080
kube-proxy(iptables)
Nodes
①
:50000
/* : “my-products” service
/discounted “my-discounted-products” service
External HTTP(S)
Load Balancing
External Traffic
34.69.XX.XX:443
iptables のバランシング
アルゴリズムはRandom
27. と を使った負荷分散イメージ
Pod Pod Pod Pod Pod Pod
NIC NIC NIC
:50000 :50000
① : External HTTP(S) Load Balancing が
トラフィックを受信
② : Path 毎に指定されたService の Pod に
直接転送
②
:8080:8080:8080
Nodes
①
:50000
35.244.**.**
/* : “my-products” service
/discounted “my-discounted-products” service
External Traffic
Health check は
各 Endpoint ( Pod ) の
target port に
対して行われる
External HTTP(S)
Load Balancing
37. コントロールプレーンはGoogle 管理
Istio の各コントローラは
Google の Proprietary に置き換え
● Istio Pilot >> Traffic Director
● Istio Citadel >> Mesh CA
● Istio Mixer >> Managed backends
概要 External Traffic
Traffic Director
Config to
Envoys
(xDSv2 APIs)
TLS certs to
Envoys
Telemetry
Mesh CA
HTTP, gRPC, TCP
mTLS
Managed
backends
GA BetaAlpha
Anthos GKE Single Cluster
Data Plane
Control Plane managed by Google
App A
Envoy
App B
Envoy
51. Pod
kube-proxy(iptables)
Pod Pod Pod Pod Pod
NIC NIC NIC
① : Internal TCP/UDP Load Balancing が
VPC内のホストからトラフィックを受信
② : Node のいずれかに宛先IP/Port は
変えずにバランシングしつつ転送
③ : kube-proxy(iptables) に転送
④ : kube-proxy(iptables) から青 Pod の
いずれかにバランシングしつつ転送
①
②
③
④
Nodes
:8080 :8080 :8080
トラフィックのイメージ
192.168.2.14:80Internal TCP/UDP
Load Balancing
Internal Traffic
LB からの Health Check は
各ノードのkube-proxy の
/healthz に対して
TCP 10256 で行っている
iptables のバランシング
アルゴリズムはRandom
56. トラフィックの負荷分散イメージ
Pod Pod Pod Pod Pod Pod
NIC NIC NIC
:50000 :50000
① : Internal HTTP(S) Load Balancing が
トラフィックを受信
② : Path 毎に指定されたService の Pod に
直接転送
②
:8080:8080:8080 :50000
10.254..**.**
/* : “my-products” service
/discounted “my-discounted-products” service
Health check は
各 Endpoint ( Pod ) の
target port に
対して行われる
Internal HTTP(S)
Load Balancing
Internal Traffic