Add support for metallb installation
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -5,5 +5,4 @@ metadata:
|
|||||||
namespace: metallb-system
|
namespace: metallb-system
|
||||||
spec:
|
spec:
|
||||||
addresses:
|
addresses:
|
||||||
# - 192.168.178.220-192.168.178.225 #pve-82
|
- {{ .Env.METALLB_ADDRESS_RANGE }}
|
||||||
- 192.168.178.160-192.168.178.180 #pve-83
|
|
||||||
47
Metallb_Setup/justfile
Normal file
47
Metallb_Setup/justfile
Normal 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
|
||||||
1
env/env.local.gomplate
vendored
1
env/env.local.gomplate
vendored
@@ -3,3 +3,4 @@ K8S_CONTEXT={{ .Env.K8S_CONTEXT }}
|
|||||||
K8S_MASTER_NODE_NAME={{ .Env.K8S_MASTER_NODE_NAME }}
|
K8S_MASTER_NODE_NAME={{ .Env.K8S_MASTER_NODE_NAME }}
|
||||||
SERVER_IP={{ .Env.SERVER_IP }}
|
SERVER_IP={{ .Env.SERVER_IP }}
|
||||||
AGENT_IP={{ .Env.AGENT_IP }}
|
AGENT_IP={{ .Env.AGENT_IP }}
|
||||||
|
METALLB_ADDRESS_RANGE={{ .Env.METALLB_ADDRESS_RANGE }}
|
||||||
|
|||||||
14
env/justfile
vendored
14
env/justfile
vendored
@@ -70,7 +70,7 @@ setup:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
while [ -z "${AGENT_IP}" ]; do
|
while [ -z "${AGENT_IP}" ]; do
|
||||||
if ! AGENT_IP=$(
|
if ! AGENT_IP=$(
|
||||||
gum input --prompt="IP of Agent Node: " \
|
gum input --prompt="IP of Agent Node: " \
|
||||||
--width=100 --placeholder="Agent Node IP"
|
--width=100 --placeholder="Agent Node IP"
|
||||||
@@ -79,5 +79,17 @@ setup:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
while [ -z "${METALLB_ADDRESS_RANGE}" ]; do
|
||||||
|
if ! METALLB_ADDRESS_RANGE=$(
|
||||||
|
gum input --prompt="IP Range for LoadBalancer: " \
|
||||||
|
--width=100 --placeholder="[x.x.x.x-y.y.y.y]"
|
||||||
|
); then
|
||||||
|
echo "Setup cancelled." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
rm -f ../.env.local
|
rm -f ../.env.local
|
||||||
gomplate -f env.local.gomplate -o ../.env.local
|
gomplate -f env.local.gomplate -o ../.env.local
|
||||||
|
|||||||
Reference in New Issue
Block a user