当前位置:网站首页>Why does the kubernetes environment require that bridge NF call iptables be enabled?
Why does the kubernetes environment require that bridge NF call iptables be enabled?
2022-06-24 13:23:00 【imroc】
This article excerpts from kubernetes Learning notes
background
Kubernetes Environment , Many times, the node kernel parameters are required to be enabled bridge-nf-call-iptables
:
sysctl -w net.bridge.bridge-nf-call-iptables=1
Refer to official documentation Network Plugin Requirements
If it is not turned on or the parameter is turned off due to some operation , It may cause some strange network problems , It's very troublesome to investigate .
Why open it ? This article will tell you in detail .
Bridge based container network
Kubernetes There are many implementations of cluster networks , A large part of it is used Linux bridge :
- Every Pod All of the network cards are veth equipment ,veth pair The other end of is connected to the bridge on the host computer .
- Because the bridge is a virtual layer 2 device , Of the same node Pod The communication between them goes through layer 2 forwarding , Cross node communication will pass through the host eth0.
Service Communication with nodes
Whether it's iptables still ipvs Forwarding mode ,Kubernetes Medium visit Service It's all going on DNAT, Will visit ClusterIP:Port Data packets of DNAT become Service One of the Endpoint (PodIP:Port), Then the kernel inserts the connection information into conntrack Table to record connections , When the destination side returns the package, the kernel starts from conntrack Tables match joins and reverse NAT, In this way, the original path returns to form a complete connection link :
however Linux A bridge is a virtual layer-2 forwarding device , and iptables conntrack It's on the third floor , So if you directly access the address in the same bridge , It's going to go straight to the second level , Not pass conntrack:
- Pod visit Service, Purpose IP yes Cluster IP, Not the address in the bridge , Three layers of forwarding , Will be DNAT become PodIP:Port.
- If DNAT Then it was forwarded to the same node Pod, Purpose Pod I found the purpose when I returned the package IP On the same bridge , Just go straight to the second level forwarding , There is no call conntrack, The result is that there is no original way to return the packet ( See the picture below ).
Because there is no way back , The communication between client and server is not in the same place " channel " On , I don't think it's in the same connection , So we can't communicate properly .
The common problem phenomenon is the occasional occurrence DNS Parse failure , When coredns On the node pod analysis dns when ,dns The request falls on the current node coredns pod Upper time , This problem may occur .
Turn on bridge-nf-call-iptables
If Kubernetes In the network link of the environment bridge May encounter the above Service Communication with nodes , and Kubernetes Many network implementations use bridge.
Enable bridge-nf-call-iptables
This kernel parameter ( Set as 1), Express bridge The device also calls when forwarding on the second layer iptables Three levels of rules for configuration ( contain conntrack), So turning on this parameter can solve the above problem Service Communication with nodes , That's why Kubernetes Environment , Most of them require opening bridge-nf-call-iptables
Why .
边栏推荐
- How can junior middle school developers effectively reduce their own workload?
- 我从根上解决了微信占用手机内存问题
- 爱可可AI前沿推介(6.24)
- SYSTEMd common component description
- Use abp Zero builds a third-party login module (I): Principles
- 简述聚类分析
- "I, an idiot, have recruited a bunch of programmers who can only" Google "
- Brief introduction to cluster analysis
- Why is open source technology so popular in the development of audio and video streaming media platform?
- 一文理解OpenStack网络
猜你喜欢
Use terminal to activate CONDA service in pypharm (the ultimate method is definitely OK)
Detailed explanation of abstractqueuedsynchronizer, the cornerstone of thread synchronization
青藤入选工信部网安中心“2021年数字技术融合创新应用典型解决方案”
面试官:MySQL 数据库查询慢,除了索引问题还可能是什么原因?
Mlife forum | microbiome and data mining
1、贪吃蛇游戏设计
A hero's note stirred up a thousand waves across 10 countries, and the first-line big factories sent people here- Gwei 2022 Singapore
Teach you how to use airtestide to connect your mobile phone wirelessly!
C语言中常量的定义和使用
物联网?快来看 Arduino 上云啦
随机推荐
Use terminal to activate CONDA service in pypharm (the ultimate method is definitely OK)
实现领域驱动设计 - 使用ABP框架 - 更新操作实体
About the hacked database
SCRM, a breakthrough in the new consumption era
What should I do if I fail to apply for the mime database? The experience from failure to success is shared with you ~
MySQL master-slave replication
16 safety suggestions from metamask project to solid programmers
Several common DoS attacks
1. Snake game design
Boss direct employment IPO: both the end and the beginning
Coinbase将推出首个针对个人投资者的加密衍生产品
The introduction of MySQL memory parameters is divided into two categories: thread exclusive and global sharing
Troubleshooting and optimization of files that cannot be globally searched by ordinary users in easydss video platform customization project
[data mining] final review (sample questions + a few knowledge points)
Understanding openstack network
39 - read XML node and attribute values
Sqlserver 2000 has long-lasting vitality
CVPR 2022 - Interpretation of selected papers of meituan technical team
Internet of things? Come and see Arduino on the cloud
TCP triple handshake