|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/multiple_networks/configuring-additional-network.adoc |
| 4 | +// * networking/hardware_networks/configuring-sriov-net-attach.adoc |
| 5 | +// * virt/vm_networking/virt-connecting-vm-to-sriov.adoc |
| 6 | + |
| 7 | +:_mod-docs-content-type: PROCEDURE |
| 8 | +[id="nw-multus-whereabouts-fast-ipam_{context}"] |
| 9 | += Fast IPAM configuration for the Whereabouts IPAM CNI plugin |
| 10 | + |
| 11 | +Wherabouts is an IP Address Management (IPAM) Container Network Interface (CNI) plugin that assigns IP addresses at a cluster-wide level. Whereabouts does not require a Dynamic Host Configuration Protocol (DHCP) server. |
| 12 | + |
| 13 | +A typical Wherabouts workflow is described as follows: |
| 14 | + |
| 15 | +. Whereabouts takes an address range in classless inter-domain routing (CIDR) notation, such as `192.168.2.0/24`, and assigns IP addresses within that range, such as `192.168.2.1` to `192.168.2.254`. |
| 16 | +. Whereabouts assigns an IP address, the lowest value address in a CIDR range, to a pod and tracks the IP address in a data store for the lifetime of that pod. |
| 17 | +. When the pod is removed, Whereabouts frees the address from the pod so that the address is available for assignment. |
| 18 | + |
| 19 | +To improve the performance of Whereabouts, especially if nodes in your cluster run a high amount of pods, you can enable the Fast IPAM feature. |
| 20 | + |
| 21 | +:FeatureName: Fast IPAM |
| 22 | +include::snippets/technology-preview.adoc[leveloffset=+1] |
| 23 | + |
| 24 | +The Fast IPAM feature uses `nodeslicepools`, which are managed by the Whereabouts Controller, to optimize IP allocation for nodes. |
| 25 | + |
| 26 | +.Prerequisites |
| 27 | + |
| 28 | +* You added the `whereabouts-shim` configuration to the `Network.operator.openshift.io` custom resource (CR), so that the Cluster Network Operator (CNO) can deploy the Whereabouts Controller. See "Creating a Whereabouts reconciler daemon set". |
| 29 | +* For the Fast IPAM feature to work, ensure that the `NetworkAttachmentDefinition` (NAD) and the pod exist in the same `openshift-multus` namesapace. |
| 30 | +
|
| 31 | +.Procedure |
| 32 | + |
| 33 | +. Confirm that the Whereabouts Controller is running by entering the following command. |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ oc get pods -n openshift-multus | grep controller |
| 38 | +---- |
| 39 | ++ |
| 40 | +.Example output |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +multus-admission-controller-d89bc96f-gbf7s 2/2 Running 0 6h3m |
| 44 | +... |
| 45 | +---- |
| 46 | ++ |
| 47 | +[IMPORTANT] |
| 48 | +==== |
| 49 | +If the Whereabouts Controller is not running, the Fast IPAM does not work. |
| 50 | +==== |
| 51 | + |
| 52 | +. Create a NAD file for your cluster and add the Fast IPAM details to the file: |
| 53 | ++ |
| 54 | +.Example NAD file with a Fast IPAM configuration |
| 55 | +[source,yaml,subs="attributes+,quotes"] |
| 56 | +---- |
| 57 | +apiVersion: "k8s.cni.cncf.io/v1" |
| 58 | +kind: NetworkAttachmentDefinition |
| 59 | +metadata: |
| 60 | + name: wb-ipam |
| 61 | + namespace: openshift-multus <1> |
| 62 | +spec: |
| 63 | + config: { |
| 64 | + "cniVersion": "0.3.0", |
| 65 | + "name": "wb-ipam-cni-name", <2> |
| 66 | + "type": "bridge", |
| 67 | + "bridge": "cni0", |
| 68 | + "ipam": { |
| 69 | + "type": "whereabouts", <3> |
| 70 | + "range": "10.5.0.0/20", <4> |
| 71 | + "node_slice_size": "/24" <5> |
| 72 | + } |
| 73 | + } |
| 74 | +# ... |
| 75 | +---- |
| 76 | +<1> The namespace where CNO deploys the NAD. |
| 77 | +<2> The name of the Whereabouts IPAM CNI plugin. |
| 78 | +<3> The type of IPAM CNI plugin: `whereabouts`. |
| 79 | +<4> The IP address range for the IP pool that the Whereabouts IPAM CNI plugin uses for allocating IP addresses to pods. |
| 80 | +<5> Sets the slice size of IP addresses available to each node. |
| 81 | + |
| 82 | +. Add the Whereabouts IPAM CNI plugin annotation details to the YAML file for the pod: |
| 83 | ++ |
| 84 | +[source,yaml,subs="attributes+,quotes"] |
| 85 | +---- |
| 86 | +apiVersion: v1 |
| 87 | +kind: Pod |
| 88 | +metadata: |
| 89 | + name: <pod_name> <1> |
| 90 | + annotations: |
| 91 | + k8s.v1.cni.cncf.io/networks: openshift-multus/wb-ipam <2> |
| 92 | +spec: |
| 93 | + containers: |
| 94 | + - name: samplepod <3> |
| 95 | + command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"] <4> |
| 96 | + image: alpine |
| 97 | +# ... |
| 98 | +---- |
| 99 | +<1> The name of the pod. |
| 100 | +<2> The annotation details that references the Whereabouts IPAM CNI plugin name that exists in the `openshift-multus` namespace. |
| 101 | +<3> The name of the container for the pod. |
| 102 | +<4> Defines the entry point for the container and controls the behavior of the container in the Whereabouts IPAM CNI plugin. |
| 103 | + |
| 104 | +. Apply the NAD file configuration to pods that exist on nodes that run in your cluster: |
| 105 | ++ |
| 106 | +[source,terminal] |
| 107 | +---- |
| 108 | +$ oc create -f <NAD_file_name>.yaml |
| 109 | +---- |
| 110 | + |
| 111 | +.Verification |
| 112 | + |
| 113 | +. Show the IP address details of the pod by entering the following command: |
| 114 | ++ |
| 115 | +[source,terminal,subs="attributes+,quotes"] |
| 116 | +---- |
| 117 | +$ oc describe pod <pod_name> |
| 118 | +---- |
| 119 | ++ |
| 120 | +.Example output |
| 121 | ++ |
| 122 | +[source,terminal] |
| 123 | +---- |
| 124 | +... |
| 125 | +IP: 192.168.2.0 |
| 126 | +IPs: |
| 127 | + IP: 192.168.2.0 |
| 128 | +Containers: |
| 129 | + samplepod: |
| 130 | + Container ID: docker://<image_name> |
| 131 | + Image: <app_name>:v1 |
| 132 | + Image ID: |
| 133 | +... |
| 134 | +---- |
| 135 | + |
| 136 | +. Access the pod and confirm its interfaces by entering the following command: |
| 137 | ++ |
| 138 | +[source,terminal] |
| 139 | +---- |
| 140 | +$ oc exec <pod_name> -- ip a |
| 141 | +---- |
| 142 | ++ |
| 143 | +.Example output |
| 144 | +[source,terminal] |
| 145 | +---- |
| 146 | +... |
| 147 | +3: net1@if23: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue |
| 148 | + link/ether 82:01:98:e5:0c:b7 brd ff:ff:ff:ff:ff:ff |
| 149 | + inet 192.168.2.0/24 brd 10.10.0.255 scope global net1 <1> |
| 150 | + valid_lft forever preferred_lft forever |
| 151 | + inet6 fe80::8001:98ff:fee5:cb7/64 scope link |
| 152 | + valid_lft forever preferred_lft forever |
| 153 | +... |
| 154 | +---- |
| 155 | +<1> Pod is attached to the `192.168.2.1` IP address on the `net1` interface as expected. |
| 156 | + |
| 157 | +. Check that the node selector pool exists in the `openshift-multus` namespace by entering the following command: |
| 158 | ++ |
| 159 | +[source,terminal] |
| 160 | +---- |
| 161 | +$ oc get nodeslicepool -n openshift-multus |
| 162 | +---- |
| 163 | ++ |
| 164 | +.Example output |
| 165 | +[source,terminal] |
| 166 | +---- |
| 167 | +NAME AGE |
| 168 | +nodeslicepool 32m |
| 169 | +---- |
0 commit comments