1.11. 捕获附加到网桥的 NIC 的静态 IP
重要
捕获 NIC 的静态 IP 只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
有关红帽技术预览功能支持范围的更多信息,请参阅以下链接:
1.11.1. 示例:Linux 网桥接口节点网络配置策略,用于从附加到网桥的 NIC 中继承静态 IP 地址 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
在集群的节点上创建一个 Linux 网桥接口,并通过将单个 NodeNetworkConfigurationPolicy 清单应用到集群来将 NIC 的静态 IP 配置传输到桥接。
以下 YAML 文件是 Linux 网桥界面的清单示例。它包含了示例值,需要使用自己的信息替换。
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: br1-eth1-copy-ipv4-policy
spec:
nodeSelector:
node-role.kubernetes.io/worker: ""
capture:
eth1-nic: interfaces.name=="eth1"
eth1-routes: routes.running.next-hop-interface=="eth1"
br1-routes: capture.eth1-routes | routes.running.next-hop-interface := "br1"
desiredState:
interfaces:
- name: br1
description: Linux bridge with eth1 as a port
type: linux-bridge
state: up
ipv4: "{{ capture.eth1-nic.interfaces.0.ipv4 }}"
bridge:
options:
stp:
enabled: false
port:
- name: eth1
routes:
config: "{{ capture.br1-routes.routes.running }}"