|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/node_network/virt-updating-node-network-config.adoc |
| 4 | + |
| 5 | +:_content-type: REFERENCE |
| 6 | +[id="virt-example-inherit-static-ip-from-nic_{context}"] |
| 7 | += Example: Linux bridge interface node network configuration policy to inherit static IP address from the NIC attached to the bridge |
| 8 | + |
| 9 | +Create a Linux bridge interface on nodes in the cluster and transfer the static IP configuration of the NIC to the bridge by applying a single `NodeNetworkConfigurationPolicy` manifest to the cluster. |
| 10 | + |
| 11 | +The following YAML file is an example of a manifest for a Linux bridge interface. It includes sample values that you must replace with your own information. |
| 12 | + |
| 13 | + |
| 14 | +[source,yaml] |
| 15 | +---- |
| 16 | +apiVersion: nmstate.io/v1 |
| 17 | +kind: NodeNetworkConfigurationPolicy |
| 18 | +metadata: |
| 19 | + name: br1-eth1-copy-ipv4-policy <1> |
| 20 | +spec: |
| 21 | + nodeSelector: <2> |
| 22 | + node-role.kubernetes.io/worker: "" |
| 23 | + capture: |
| 24 | + eth1-nic: interfaces.name=="eth1" <3> |
| 25 | + eth1-routes: routes.running.next-hop-interface=="eth1" |
| 26 | + br1-routes: capture.eth1-routes | routes.running.next-hop-interface := "br1" |
| 27 | + desiredState: |
| 28 | + interfaces: |
| 29 | + - name: br1 |
| 30 | + description: Linux bridge with eth1 as a port |
| 31 | + type: linux-bridge <4> |
| 32 | + state: up |
| 33 | + ipv4: "{{ capture.eth1-nic.interfaces.0.ipv4 }}" <5> |
| 34 | + bridge: |
| 35 | + options: |
| 36 | + stp: |
| 37 | + enabled: false |
| 38 | + port: |
| 39 | + - name: eth1 <6> |
| 40 | + routes: |
| 41 | + config: "{{ capture.br1-routes.routes.running }}" |
| 42 | +---- |
| 43 | +<1> The name of the policy. |
| 44 | +<2> Optional: If you do not include the `nodeSelector` parameter, the policy applies to all nodes in the cluster. This example uses the `node-role.kubernetes.io/worker: ""` node selector to select all worker nodes in the cluster. |
| 45 | +<3> The reference to the node NIC to which the bridge attaches. |
| 46 | +<4> The type of interface. This example creates a bridge. |
| 47 | +<5> The IP address of the bridge interface. This value matches the IP address of the NIC which is referenced by the `spec.capture.eth1-nic` entry. |
| 48 | +<6> The node NIC to which the bridge attaches. |
0 commit comments