mirror of
https://github.com/JamesTurland/JimsGarage.git
synced 2026-08-02 05:46:14 +00:00
Fix RKE2 MetalLB L2Advertisement to honor custom lb_pool_name (#135)
The apply-manifests role rendered the IPAddressPool from a template using lb_pool_name, but applied the L2Advertisement from a hardcoded remote file where the pool name was baked in as 'first-pool'. Setting lb_pool_name to anything else left the L2Advertisement pointing at a non-existent pool, so MetalLB assigned LoadBalancer IPs but never advertised them (services got an external IP but were unreachable). Template the L2Advertisement locally from lb_pool_name, mirroring the IPAddressPool pattern, so both manifests always reference the same pool.
This commit is contained in:
@@ -33,10 +33,20 @@
|
|||||||
become_user: "{{ ansible_user }}"
|
become_user: "{{ ansible_user }}"
|
||||||
when: inventory_hostname == groups['servers'][0]
|
when: inventory_hostname == groups['servers'][0]
|
||||||
|
|
||||||
|
# Deploy L2 Advertisement to Server 1 (templated so it matches lb_pool_name)
|
||||||
|
- name: Copy metallb L2 Advertisement to server 1
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: templates/metallb-l2advertisement.j2
|
||||||
|
dest: /home/{{ ansible_user }}/l2advertisement.yaml
|
||||||
|
owner: "{{ ansible_user }}"
|
||||||
|
group: "{{ ansible_user }}"
|
||||||
|
mode: '0755'
|
||||||
|
when: inventory_hostname == groups['servers'][0]
|
||||||
|
|
||||||
# Apply L2 Advertisement for metallb
|
# Apply L2 Advertisement for metallb
|
||||||
- name: Apply metallb L2 Advertisement
|
- name: Apply metallb L2 Advertisement
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: kubectl apply -f https://raw.githubusercontent.com/JamesTurland/JimsGarage/main/Kubernetes/RKE2/l2Advertisement.yaml
|
cmd: kubectl apply -f /home/{{ ansible_user }}/l2advertisement.yaml
|
||||||
become_user: "{{ ansible_user }}"
|
become_user: "{{ ansible_user }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
when: inventory_hostname == groups['servers'][0]
|
when: inventory_hostname == groups['servers'][0]
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: L2Advertisement
|
||||||
|
metadata:
|
||||||
|
name: example
|
||||||
|
namespace: metallb-system
|
||||||
|
spec:
|
||||||
|
ipAddressPools:
|
||||||
|
- {{ lb_pool_name }}
|
||||||
Reference in New Issue
Block a user