当前位置:网站首页>[tke] analysis of CLB loopback in Intranet under IPVS forwarding mode
[tke] analysis of CLB loopback in Intranet under IPVS forwarding mode
2022-06-24 16:17:00 【jokey】
Problem description
There are two customers in the cluster Service There is an accidental timeout between calls , After investigation, it was found that it triggered TKE Intranet in CLB Loopback problems lead to ( Public network in the same scenario CLB There is no such loopback problem ), However, the customer reported that another cluster has a similar invocation scenario , However, there has been no timeout . After checking and comparing , In two clusters Service The invocation scenarios are indeed consistent , However, the invoked services in the two clusters Service in externalTrafficPolicy Configuration difference , The cluster with loopback problem is configured as "Local", The cluster configuration without loopback problem is "Cluster".
Say first conclusion
Why use "externalTrafficPolicy=Local " With loopback problem , While using "externalTrafficPolicy=Cluster" No loopback problem ?
It is found by capturing packets on the outgoing node network cards of two different clusters , Clusters with loopback problems are Pod A visit CLB IP When leaving the node, no SNAT, When accessing a cluster without loopback problems, the outgoing node does SNAT( Request source IP Convert to nodes IP), And because of CLB When forwarding, the request source will be determined IP, If the forwarding backend list is found to be the same as the request source IP Backend , It will not be forwarded to the backend ,⽽ Select another backend , So I did SNAT Our cluster just avoids the loopback problem .
Problem analysis
Scenarios that trigger loopback problems :
When a container in a cluster Pod A Through the intranet CLB exposed Service B service (Pod B) May occur .
Link triggered by loopback problem :
PodA(client) -> CLB( Intranet ) -> Service B( Just forward to Pod A Node NodePort )-> Pod .
Because the deployment scenarios of the two clusters are consistent , That is, the trigger scenario that satisfies the loopback problem , stay TKE IPVS In forwarding mode , pod The service message of internal access load balancer type needs to go out of the node ( because LB IP Not bound to ipvs0 Interface ), So by default iptables The rule out node should be to do SNAT Of , However, there is a loopback problem. In fact, the outgoing node of the cluster has not done so SNAT, So let's analyze Service in externalTrafficPolicy The effect of different configurations of on the forwarding link of container network packets .
contrast iptables Rule differences
First, compare the two cluster nodes iptables(NAT surface ) Forwarding rules for :
Found in the cluster Service Set up “externalTrafficPolicy=Local ” There will be two more nodes dedicated to "externalTrafficPolicy=Local" Added Of iptables The rules .
How rule differences affect the forwarding of packets from the container's outgoing nodes :
externalTrafficPolicy Configure to Local Its function is to keep the client source IP And avoid LoadBalancer and NodePort Second hop forwarding of type service , Details refer to :externalTrafficPolicy Introduce .
according to iptables Rule knowledge , We see that when the network packet is about to leave the node , Must hit first OUTPUT chain :
-A OUTPUT -m comment --comment "kubernetes service portals" -j KUBE-SERVICES
Then go down and have a look according to the follow-up chain forwarding rules :
Service Use the default “externalTrafficPolicy=Cluster ” Cluster node of , Did SNAT The situation of :
Service Set up “externalTrafficPolicy=Local ” Cluster node of , Didn't do SNAT The situation of :
As can be seen from the above comparison , although Service Of externalTrafficPolicy Configuration is intended to handle access Service In the direction of flow , But adding rules does affect container access CLB Policy when leaving the node , This determines whether there is an intranet CLB Loopback problem .
Reference material :https://kubernetes.io/blog/2018/07/09/ipvs-based-in-cluster-load-balancing-deep-dive/
边栏推荐
- 2021-04-22: given many line segments, each line segment has two numbers [start, end],
- MySQL InnoDB and MyISAM
- Inter thread communication of embedded development foundation
- D. Solve the maze (thinking +bfs) codeforces round 648 (Div. 2)
- [C language questions -- leetcode 12 questions] take you off and fly into the garbage
- C. K-th not divisible by n (Mathematics + thinking) codeforces round 640 (Div. 4)
- Install the imagemagick7.1 library and the imageick extension for PHP
- 一文详解JackSon配置信息
- Remain true to our original aspiration
- Istio FAQ: sidecar stop sequence
猜你喜欢

How to easily realize online karaoke room and sing "mountain sea" with Wang Xinling

C. K-th Not Divisible by n(数学+思维) Codeforces Round #640 (Div. 4)

Wechat official account debugging and natapp environment building

Siggraph 2022 | truly restore the hand muscles. This time, the digital human hands have bones, muscles and skin

Linux record -4.22 MySQL 5.37 installation (supplementary)
![Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)](/img/33/2c2256fd98b908ddaf5573f644ad7f.png)
Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)
![[C language questions -- leetcode 12 questions] take you off and fly into the garbage](/img/ca/a356a867f3b7ef2814080fb76b9bfb.png)
[C language questions -- leetcode 12 questions] take you off and fly into the garbage

SIGGRAPH 2022 | 真实还原手部肌肉,数字人双手这次有了骨骼、肌肉、皮肤

存在安全隐患 路虎召回部分混动揽运

Still worried about missing measurements? Let's use Jacobo to calculate the code coverage
随机推荐
great! The novel website project is completely open source
How to obtain ECS metadata
April 26, 2021: the length of the integer array arr is n (3 < = n < = 10^4), and each number is
Goby+awvs realize attack surface detection
企业安全攻击面分析工具
How does the effective date of SAP PP ECM affect the work order?
MySQL date timestamp conversion
Detailed explanation of transpose convolution in pytorch
How to open a futures account safely? Which futures companies are more reliable?
2021-05-02: given the path of a file directory, write a function
构建Go命令行程序工具链
MySQL日期时间戳转换
[C language questions -- leetcode 12 questions] take you off and fly into the garbage
Fastjson vulnerability utilization techniques
Logging is not as simple as you think
Global and Chinese market for commercial barbecue smokers 2022-2028: Research Report on technology, participants, trends, market size and share
How to easily realize online karaoke room and sing "mountain sea" with Wang Xinling
April 23, 2021: there are n cities in the TSP problem, and there is a distance between any two cities
PyTorch中的转置卷积详解
MySQL InnoDB and MyISAM