docs(metallb-config): update metallb guides (#29798)

**Description**
Updates metallb guides with yaml examples.

⚒️ Fixes  # 

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**

**📃 Notes:**

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning
- [ ] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
kqmaverick
2024-11-29 12:03:01 -07:00
committed by GitHub
parent ea7a259e79
commit 7bb22b6eba
@@ -4,97 +4,43 @@ title: MetalLB Basic Setup
The guide walks through a basic configuration of MetalLB for a single address pool on a layer 2 network. This will allow assigning different IP addresses by app.
:::caution
## Set Address Pool & L2 Advertisement in MetalLB-Config
With MetalLB installed, apps will not be reachable using the integrated LoadBalancer. You cannot combine two different LoadBalancers in TrueNAS SCALE.
Configure `metallb-config` `values.yaml` as shown below.
:::
```yaml
// values.yaml
ipAddressPools:
# Enter a general name for this IP range. Something like _main_ for this field is fine.
- name: main
# If you want MetalLB Services to auto-assign IPs from the configured address pool without needing to specify per chart.
autoAssign: false
avoidBuggyIPs: true
# Specify an IP range for MetalLB to assign IPs that is **OUTSIDE** your current DHCP range on your LAN. For example, if your DHCP range is `192.168.1.100-192.168.1.255`, then your entry can be any range below `192.168.1.100`. This entry can also be specified in CIDR format.
# For users with VLANs or multiple subnets, you may create create additional address pool objects as needed.
addresses:
- 192.168.1.1-192.168.1.100
L2Advertisements:
# Enter a basic name for your layer 2 advertisement.
- name: main
# Use the same name as defined above.
addressPools:
- main
```
## Prerequisites
## 3. Optional: Specify IP Address per Chart or Service
- Add the system & premium trains to your TrueCharts Catalog.
![metallb-addtrains](./img/metallb_guide_trains.png)
:::caution
Our customized version of MetalLB is only intended for use with other TrueCharts applications. Other catalogs will likely not support our MetalLB application. MetalLB could technically work with TrueNAS catalog apps if they used the LoadBalancer service, but they don't as they use NodePort instead. These atypical configurations aren't officially supported nor encouraged by TrueCharts.
:::
## 1. Install MetalLB Operator from system Train
![metallb-apps](./img/metallb_guide_apps.png)
Install `metallb` from `system` train first. There is no config, so just hit save.
If you encounter an error upon install, run the following command as root from system settings -> shell and attempt the install again:
`k3s kubectl delete --grace-period 30 --v=4 -k https://github.com/truecharts/manifests/delete`
If you previously had `metallb` installed and encounter an error, delete the old version, then run the above command before proceeding to install the `metallb` operator.
## 2. Set Address Pool & L2 Advertisement in MetalLB-Config
Install `metallb-config` from premium train and create a new entry under `Configure IP Address Pools Object`
![metallb-addpoolbasic](./img/metallb_guide_addresspool_basic.png)
- **Name**: Enter a general name for this IP range. Something like _apps_ or _charts_ for this field is fine.
- **Auto Assign**: if you want MetalLB Services to auto-assign IPs from the configured address pool without needing to specify per app. Recommendation is to keep this checked. You can still specify an IP for apps as needed (see step 3).
Create a single entry under `Configure Address Pools`
- **Address Pool Entry:** Specify an IP range for MetalLB to assign IPs that is **OUTSIDE** your current DHCP range on your LAN. For example, if your DHCP range is `192.168.1.100-192.168.1.255`, then your entry can be any range below `192.168.1.100`. This entry can also be specified in CIDR format.
_For users with VLANs or multiple subnets, you may create create additional address pool objects as needed._
![metallb-l2advertisement](./img/metallb_guide_l2advertisement.png)
Create a new entry under `Configure L2 Advertisements`.
- **Name**: Enter a basic name for your layer 2 advertisement.
- **Address Pool Entry:** This should match the **name** of the address pool created above (not the IP range itself).
:::tip
Once installed, `metallb-config` will always show as Stopped.
:::
## 3. Optional: Specify IP Address per App or Service
![metallb-specifyIP](./img/metallb_guide_specifyIP.png)
With MetalLB installed, it's recommended (but optional) to specify IP addresses for your apps.
For each app, under **Networking and Services**, select `LoadBalancer` Service Type for the Main Service.
In the **LoadBalancer IP** field, specify an IP address that is within the MetalLB address pool that you configured. Apply the same IP address to the **LoadBalancer IP** field on other services within the app.
## 4. Disable SCALE's Default LoadBalancer
With MetalLB installed and configured, you must now disable SCALE's default LoadBalancer.
In the SCALE UI, under **Apps** > **Settings** > **Advanced Settings**
![metallb-disable](./img/metallb_guide_disableLB.png)
Uncheck `Enable Integrated LoadBalancer`.
**This will trigger a restart of Kubernetes and all apps**. After roughly 5-10 minutes, your apps will redeploy using the MetalLB-assigned IP addresses.
```yaml
// values.yaml
service:
main:
loadBalancerIP: 192.168.1.10
```
## 5. Verify IP Addresses Are Assigned
From your SCALE shell, run the command `k3s kubectl get svc -A` to verify the IP addresses assigned for each of your apps. The IPs will be listed under the `EXTERNAL-IP` column.
Run the command `kubectl get svc -A` to verify the IP addresses assigned for each of your charts. The IPs will be listed under the `EXTERNAL-IP` column.
If you have an IP conflict with a previously assigned address it will show as `<pending>`.
**You may need to do a system reboot as well to properly resolve the conflict.**
:::caution
Known Issue: On the SCALE Installed Applications page, the **Open** buttons on each app card will still open a URL to your app using your SCALE Host IP, rather than the MetalLB-Assigned IP. You may need to refresh the page in your browser, bypassing your browser's cache by doing `CTRL + F5`. This may be resolved in the future.
:::
For details on other configuration options, please reference the [MetaLB documentation](https://metallb.universe.tf/configuration/).