当前位置:网站首页>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 .
边栏推荐
- 手机开户后多久才能通过?在线开户安全么?
- C语言中常量的定义和使用
- Integrate API interface parameter Dictionary of accounts of multiple local distribution companies - Express 100
- Getting started with the lvgl Library - colors and images
- Boss direct employment IPO: both the end and the beginning
- Kubernetes集群部署
- Creation and use of unified links in Huawei applinking
- Sphere, openai and ai21 jointly publish the best practice guidelines for deployment models
- How to create a new empty branch in the web development process of easyrtc?
- Internet of things? Come and see Arduino on the cloud
猜你喜欢

CVPR 2022 | 美團技術團隊精選論文解讀

The text to voice function is available online. You can experience the services of professional broadcasters. We sincerely invite you to try it out

openGauss内核:简单查询的执行

“有趣” 是新时代的竞争力

Babbitt | metauniverse daily must read: 618 scores have been announced. How much contribution has the digital collection made behind this satisfactory answer

系统测试主要步骤

CVPR 2022 | interprétation de certains documents de l'équipe technique de meituan

我从根上解决了微信占用手机内存问题

Codereview tool chain for micro medicine

The agile way? Is agile development really out of date?
随机推荐
AGCO AI frontier promotion (6.24)
手把手教你用AirtestIDE无线连接手机!
Parse NC format file and GRB format file dependent package edu ucar. API learning of netcdfall
Vipshop's "special sale" business is no longer easy to do?
Use terminal to activate CONDA service in pypharm (the ultimate method is definitely OK)
TCP triple handshake
Quickly understand the commonly used message summarization algorithms, and no longer have to worry about the thorough inquiry of the interviewer
J'a i ouvert quelques mots d'un ami et quelques réflexions personnelles sur le livre des six ancêtres
I have fundamentally solved the problem of wechat occupying mobile memory
go Cobra命令行工具入门
面试官:MySQL 数据库查询慢,除了索引问题还可能是什么原因?
Are you still working hard to select *? Then put away these skills
手机开户后多久才能通过?在线开户安全么?
实现领域驱动设计 - 使用ABP框架 - 创建实体
Istio Troubleshooting: uneven grpc service load
Who is the fish and who is the bait? Summary of honeypot recognition methods from the perspective of red team
脚本之美│VBS 入门交互实战
What if the WordPress website forgets its password
LVGL库入门教程 - 颜色和图像
105. simple chat room 8: use socket to transfer pictures