Skip to content

Commit 0e12c01

Browse files
Merge pull request #39068 from mikemckiernan/feat-metallb-l2-nodesel
OSDOCS-2681: nodesel and new algo
2 parents dd3c9f7 + f1e5599 commit 0e12c01

File tree

4 files changed

+55
-7
lines changed

4 files changed

+55
-7
lines changed

modules/nw-metallb-installing-operator-cli.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ $ oc get installplan -n metallb-system
108108
----
109109
+
110110
.Example output
111-
[source,terminal]
111+
[source,terminal,subs="attributes+"]
112112
----
113113
NAME CSV APPROVAL APPROVED
114-
install-wzg94 metallb-operator.4.9.0-nnnnnnnnnnnn Automatic true
114+
install-wzg94 metallb-operator.{product-version}.0-nnnnnnnnnnnn Automatic true
115115
----
116116

117117
. To verify that the Operator is installed, enter the following command:
@@ -123,9 +123,9 @@ $ oc get clusterserviceversion -n metallb-system \
123123
----
124124
+
125125
.Example output
126-
[source,terminal]
126+
[source,terminal,subs="attributes+"]
127127
----
128128
Name Phase
129-
metallb-operator.4.9.0-nnnnnnnnnnnn Succeeded
129+
metallb-operator.{product-version}.0-nnnnnnnnnnnn Succeeded
130130
----
131131

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/metallb/metallb-operator-install.adoc
4+
5+
[id="nw-metallb-operator-limit-speaker-to-nodes_{context}"]
6+
= Limit speaker pods to specific nodes
7+
8+
By default, when you start MetalLB with the MetalLB Operator, the Operator starts an instance of a `speaker` pod on each node in the cluster.
9+
Only the nodes with a `speaker` pod can advertise a load balancer IP address.
10+
You can configure the `MetalLB` custom resource with a node selector to specify which nodes run the `speaker` pods.
11+
12+
The most common reason to limit the `speaker` pods to specific nodes is to ensure that only nodes with network interfaces on specific networks advertise load balancer IP addresses.
13+
Only the nodes with a running `speaker` pod are advertised as destinations of the load balancer IP address.
14+
15+
If you limit the `speaker` pods to specific nodes and specify `local` for the external traffic policy of a service, then you must ensure that the application pods for the service are deployed to the same nodes.
16+
17+
.Example configuration to limit speaker pods to worker nodes
18+
[source,yaml]
19+
----
20+
apiVersion: metallb.io/v1beta1
21+
kind: MetalLB
22+
metadata:
23+
name: metallb
24+
namespace: metallb-system
25+
spec:
26+
nodeSelector: <.>
27+
node-role.kubernetes.io/worker: ""
28+
----
29+
<.> The example configuration specifies to assign the speaker pods to worker nodes, but you can specify labels that you assigned to nodes or any valid node selector.
30+
31+
After you apply a manifest with the `spec.nodeSelector` field, you can check the number of pods that the Operator deployed with the `oc get daemonset -n metallb-system speaker` command.
32+
Similarly, you can display the nodes that match your labels with a command like `oc get nodes -l node-role.kubernetes.io/worker=`.
33+

modules/nw-metallb-software-components.adoc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/metallb/about-metallb.adoc
4+
15
[id="nw-metallb-software-components_{context}"]
26
= MetalLB software components
37

@@ -12,14 +16,18 @@ The Operator starts the deployment and a single pod.
1216
When you add a service of type `LoadBalancer`, Kubernetes uses the `controller` to allocate an IP address from an address pool.
1317

1418
`speaker`::
15-
The Operator starts a daemon set with one `speaker` pod for each node in your cluster.
19+
The Operator starts a daemon set for `speaker` pods.
20+
By default, a pod is started on each node in your cluster.
21+
You can limit the pods to specific nodes by specifying a node selector in the `MetalLB` custom resource when you start MetalLB.
1622
+
17-
For layer 2 mode, after the `controller` allocates an IP address for the service, each `speaker` pod determines if it is on the same node as an endpoint for the service.
18-
An algorithm that involves hashing the node name and the service name is used to select a single `speaker` pod to announce the load balancer IP address.
23+
For layer 2 mode, after the `controller` allocates an IP address for the service, the `speaker` pods use an algorithm to determine which `speaker` pod on which node will announce the load balancer IP address.
24+
The algorithm involves hashing the node name and the load balancer IP address.
25+
See the section about external traffic policy for more information.
1926
// IETF treats protocol names as proper nouns.
2027
The `speaker` uses Address Resolution Protocol (ARP) to announce IPv4 addresses and Neighbor Discovery Protocol (NDP) to announce IPv6 addresses.
2128
+
2229
Requests for the load balancer IP address are routed to the node with the `speaker` that announces the IP address.
2330
After the node receives the packets, the service proxy routes the packets to an endpoint for the service.
2431
The endpoint can be on the same node in the optimal case, or it can be on another node.
2532
The service proxy chooses an endpoint each time a connection is established.
33+

networking/metallb/metallb-operator-install.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ include::modules/nw-metallb-installing-operator-cli.adoc[leveloffset=+1]
2626
// Starting MetalLB on your cluster
2727
include::modules/nw-metallb-operator-initial-config.adoc[leveloffset=+1]
2828

29+
// Limit speaker pods to specific nodes
30+
include::modules/nw-metallb-operator-limit-speaker-to-nodes.adoc[leveloffset=+2]
31+
32+
.Additional resources
33+
34+
* For more information about node selectors, see xref:../../nodes/scheduling/nodes-scheduler-node-selectors.adoc#nodes-scheduler-node-selectors[Placing pods on specific nodes using node selectors].
35+
2936
[id="next-steps_{context}"]
3037
== Next steps
3138

0 commit comments

Comments
 (0)