Add support for metallb installation

This commit is contained in:
baschno
2025-12-27 20:32:16 +01:00
parent 7ddc08d622
commit c5810661e5
7 changed files with 64 additions and 1820 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,5 +5,4 @@ metadata:
namespace: metallb-system
spec:
addresses:
# - 192.168.178.220-192.168.178.225 #pve-82
- 192.168.178.160-192.168.178.180 #pve-83
- {{ .Env.METALLB_ADDRESS_RANGE }}

47
Metallb_Setup/justfile Normal file
View File

@@ -0,0 +1,47 @@
set fallback := true
export K8S_CONTEXT := env("K8S_CONTEXT", "")
export SERVER_IP := env("K3S_SERVER_IP","192.168.178.45")
export USER := env("K3S_USER","basti")
[private]
default:
@just --list --unsorted --list-submodules
install:
#!/bin/bash
set -euo pipefail
just env::check
METALLB_VERSION="v0.15.3"
username=$(gum input --prompt="SSH username: " --value="${USER}" --width=100)
context=""
if gum confirm "Update KUBECONFIG?"; then
context=$(
gum input --prompt="Context name: " --value="${K8S_CONTEXT}" --width=100
)
fi
if [ -n "${context}" ]; then
kubectl config use-context "${context}"
fi
kubectl apply -f "https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/config/manifests/metallb-native.yaml"
gum spin --spinner dot --title "Waiting for MetalLB to be ready..." -- kubectl wait --namespace metallb-system --for=condition=available deployment --all --timeout=120s
echo "MetalLB ${METALLB_VERSION} installed successfully."
gomplate -f address-pool.gomplate.yaml | kubectl apply -f -
echo "Address pool configured."
kubectl apply -f advertisement.yaml
echo "Advertisement created."
uninstall:
#!/bin/bash
set -euo pipefail
just env::check
kubectl get namespace metallb-system &>/dev/null && kubectl delete ns metallb-system