Skip to content

Commit 5888cce

Browse files
authored
Metallb BGPPeers are generated for each node and don't have to be created manually (#91)
1 parent 0b44530 commit 5888cce

File tree

2 files changed

+0
-62
lines changed

2 files changed

+0
-62
lines changed

DEVELOPMENT.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,32 +85,6 @@ If you want to provide service's of type load balancer through MetalLB by the me
8585
kubectl --kubeconfig capi-lab/.capms-cluster-kubeconfig.yaml apply --kustomize capi-lab/metallb
8686
```
8787

88-
For each node in your Kubernetes cluster, you need to create a BGP peer configuration. Replace the placeholders ({{
89-
NODE_ASN }}, {{ NODE_HOSTNAME }}, and {{ NODE_ROUTER_ID }}) with the appropriate values for each node.
90-
91-
```bash
92-
cat <<EOF | kubectl --kubeconfig=capi-lab/.capms-cluster-kubeconfig.yaml create -f -
93-
apiVersion: metallb.io/v1beta2
94-
kind: BGPPeer
95-
metadata:
96-
name: ${NODE_HOSTNAME}
97-
namespace: metallb-system
98-
spec:
99-
holdTime: 1m30s
100-
keepaliveTime: 0s
101-
myASN: ${NODE_ASN}
102-
nodeSelectors:
103-
- matchExpressions:
104-
- key: kubernetes.io/hostname
105-
operator: In
106-
values:
107-
- ${NODE_HOSTNAME}
108-
passwordSecret: {}
109-
peerASN: ${NODE_ASN}
110-
peerAddress: ${NODE_ROUTER_ID}
111-
EOF
112-
```
113-
11488
That's it!
11589

11690
### To Deploy on the cluster

README.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -146,42 +146,6 @@ If you want to provide service's of type `LoadBalancer` through MetalLB by the `
146146
kubectl --kubeconfig capms-cluster.kubeconfig apply --kustomize capi-lab/metallb
147147
```
148148

149-
For each worker node in your Kubernetes cluster, you need to create a BGP peer configuration. Replace the placeholders (`{{
150-
NODE_ASN }}`, `{{ NODE_HOSTNAME }}`, and `{{ NODE_ROUTER_ID }}`) with the appropriate values for each node.
151-
152-
```bash
153-
# in metal-stack, list all machines of your cluster
154-
metalctl machine ls --project $METAL_PROJECT_ID
155-
156-
# for each worker machine collect the information as follows
157-
export NODE_ID=<worker-machine-id>
158-
export NODE_HOSTNAME=$(metalctl machine describe $NODE_ID -o template --template '{{ .allocation.hostname }}')
159-
export NODE_ASN=$(metalctl machine describe $NODE_ID -o template --template '{{ printf "%.0f" (index .allocation.networks 0).asn }}')
160-
export NODE_ROUTER_ID=$(metalctl machine describe $NODE_ID -o template --template '{{ (index (index .allocation.networks 0).ips 0) }}')
161-
162-
# for each worker machine generate and apply the BGPPeer resource
163-
cat <<EOF | kubectl --kubeconfig=capms-cluster.kubeconfig create -f -
164-
apiVersion: metallb.io/v1beta2
165-
kind: BGPPeer
166-
metadata:
167-
name: ${NODE_HOSTNAME}
168-
namespace: metallb-system
169-
spec:
170-
holdTime: 1m30s
171-
keepaliveTime: 0s
172-
myASN: ${NODE_ASN}
173-
nodeSelectors:
174-
- matchExpressions:
175-
- key: kubernetes.io/hostname
176-
operator: In
177-
values:
178-
- ${NODE_HOSTNAME}
179-
passwordSecret: {}
180-
peerASN: ${NODE_ASN}
181-
peerAddress: ${NODE_ROUTER_ID}
182-
EOF
183-
```
184-
185149
## Frequently Asked Questions
186150

187151
### I need to know the Control Plane IP address in advance. Can I provide a static IP address in advance?

0 commit comments

Comments
 (0)