This commit is contained in:
James Turland 2023-12-04 11:34:59 +00:00
parent 9af9a88fc3
commit 84c228b43b
4 changed files with 80 additions and 21 deletions

View file

@ -0,0 +1,8 @@
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: first-pool
namespace: metallb-system
spec:
addresses:
- $lbrange

View file

@ -1,42 +1,70 @@
#!/bin/bash apiVersion: apps/v1
echo "apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
creationTimestamp: null creationTimestamp: null
labels:
app.kubernetes.io/name: kube-vip-ds
app.kubernetes.io/version: v0.6.3
name: kube-vip-ds name: kube-vip-ds
namespace: kube-system namespace: kube-system
spec: spec:
selector: selector:
matchLabels: matchLabels:
name: kube-vip-ds app.kubernetes.io/name: kube-vip-ds
template: template:
metadata: metadata:
creationTimestamp: null creationTimestamp: null
labels: labels:
name: kube-vip-ds app.kubernetes.io/name: kube-vip-ds
app.kubernetes.io/version: v0.6.3
spec: spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
containers: containers:
- args: - args:
- manager - manager
env: env:
- name: vip_arp - name: vip_arp
value: \"true\" value: "true"
- name: vip_interface
value: $vipInterface
- name: port - name: port
value: \"6443\" value: "6443"
- name: vip_interface
value: $interface
- name: vip_cidr - name: vip_cidr
value: \"32\" value: "32"
- name: cp_enable - name: cp_enable
value: \"true\" value: "true"
- name: cp_namespace - name: cp_namespace
value: kube-system value: kube-system
- name: vip_ddns
value: "false"
- name: svc_enable - name: svc_enable
value: \"true\" value: "false"
- name: vip_address - name: svc_leasename
value: $vipAddress value: plndr-svcs-lock
image: ghcr.io/kube-vip/kube-vip:v0.5.11 - name: vip_leaderelection
value: "true"
- name: vip_leasename
value: plndr-cp-lock
- name: vip_leaseduration
value: "5"
- name: vip_renewdeadline
value: "3"
- name: vip_retryperiod
value: "1"
- name: address
value: $vip
- name: prometheus_server
value: :2112
image: ghcr.io/kube-vip/kube-vip:v0.6.3
imagePullPolicy: Always imagePullPolicy: Always
name: kube-vip name: kube-vip
resources: {} resources: {}
@ -45,15 +73,17 @@ spec:
add: add:
- NET_ADMIN - NET_ADMIN
- NET_RAW - NET_RAW
- SYS_TIME
hostNetwork: true hostNetwork: true
serviceAccountName: kube-vip serviceAccountName: kube-vip
tolerations: tolerations:
- effect: NoSchedule - effect: NoSchedule
key: node-role.kubernetes.io/master operator: Exists
- effect: NoExecute
operator: Exists
updateStrategy: {} updateStrategy: {}
status: status:
currentNumberScheduled: 0 currentNumberScheduled: 0
desiredNumberScheduled: 0 desiredNumberScheduled: 0
numberMisscheduled: 0 numberMisscheduled: 0
numberReady: 0" numberReady: 0

View file

@ -0,0 +1,8 @@
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: example
namespace: metallb-system
spec:
ipAddressPools:
- first-pool

View file

@ -159,8 +159,6 @@ kubectl get nodes
# Step 5: Install kube-vip as network LoadBalancer - Install the kube-vip Cloud Provider # Step 5: Install kube-vip as network LoadBalancer - Install the kube-vip Cloud Provider
kubectl apply -f https://kube-vip.io/manifests/rbac.yaml kubectl apply -f https://kube-vip.io/manifests/rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kube-vip/kube-vip-cloud-provider/main/manifest/kube-vip-cloud-controller.yaml kubectl apply -f https://raw.githubusercontent.com/kube-vip/kube-vip-cloud-provider/main/manifest/kube-vip-cloud-controller.yaml
#IP range for loadbalancer services to use
kubectl create configmap -n kube-system kubevip --from-literal range-global=$lbrange
# Step 6: Add other Masternodes, note we import the token we extracted from step 3 # Step 6: Add other Masternodes, note we import the token we extracted from step 3
for newnode in "${masters[@]}"; do for newnode in "${masters[@]}"; do
@ -204,7 +202,22 @@ done
kubectl get nodes kubectl get nodes
# Step 8: Install Rancher (Optional - Delete if not required) # Step 8: Install Metallb
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.12/config/manifests/metallb-native.yaml
# Download ipAddressPool and configure using lbrange above
curl -sO https://raw.githubusercontent.com/JamesTurland/JimsGarage/main/Kubernetes/RKE2/ipAddressPool
cat ipAddressPool | sed 's/$lbrange/'$lbrange'/g' > $HOME/ipAddressPool.yaml
# Step 9: Deploy IP Pools and l2Advertisement
kubectl wait --namespace metallb-system \
--for=condition=ready pod \
--selector=component=controller \
--timeout=120s
kubectl apply -f ipAddressPool.yaml
kubectl apply -f https://raw.githubusercontent.com/JamesTurland/JimsGarage/main/Kubernetes/RKE2/l2Advertisement.yaml
# Step 10: Install Rancher (Optional - Delete if not required)
#Install Helm #Install Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh chmod 700 get_helm.sh