-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from thebsdbox/arp_fixes
Fixes to arp/controller and manifests
- Loading branch information
Showing
12 changed files
with
152 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $1 && -z $2 && -z $3 && -z $4 ]]; then | ||
echo "Usage:" | ||
echo " Param 1: Kube-Vip Version" | ||
echo " Param 2: Kube-Vip mode [\"controlplane\"/\"services\"/\"hybrid\"]" | ||
echo " Param 3: Vip address" | ||
echo " Param 4: k3s url (https://github.com/k3s-io/k3s/releases/download/v1.20.4%2Bk3s1/k3s)" | ||
echo "" ./create.sh 0.3.3 hybrid 192.168.0.40 | ||
exit 1 | ||
fi | ||
|
||
case "$2" in | ||
|
||
"controlplane") echo "Creating control plane only cluster" | ||
mode="--controlplane" | ||
;; | ||
"services") echo "Creating services only cluster" | ||
mode="--services" | ||
;; | ||
"hybrid") echo "Creating hybrid cluster" | ||
mode="--controlplane --services" | ||
;; | ||
*) echo "Unknown kube-vip mode [$2]" | ||
exit -1 | ||
;; | ||
esac | ||
|
||
source ./testing/nodes | ||
|
||
echo "Creating First node!" | ||
|
||
ssh $NODE01 "sudo mkdir -p /var/lib/rancher/k3s/server/manifests/" | ||
ssh $NODE01 "sudo docker run --network host --rm plndr/kube-vip:$1 manifest daemonset $mode --interface ens160 --vip $3 --arp --leaderElection --inCluster --taint | sudo tee /var/lib/rancher/k3s/server/manifests/vip.yaml" | ||
ssh $NODE01 "sudo curl https://kube-vip.io/manifests/rbac.yaml | sudo tee /var/lib/rancher/k3s/server/manifests/rbac.yaml" | ||
ssh $NODE01 "sudo screen -dmSL k3s k3s server --cluster-init --tls-san $3 --no-deploy servicelb --disable-cloud-controller --token=test" | ||
echo "Started first node, sleeping for 60 seconds" | ||
sleep 60 | ||
echo "Adding additional nodes" | ||
ssh $NODE02 "sudo screen -dmSL k3s k3s server --server https://$3:6443 --token=test" | ||
ssh $NODE03 "sudo screen -dmSL k3s k3s server --server https://$3:6443 --token=test" | ||
sleep 20 | ||
ssh $NODE01 "sudo k3s kubectl get node -o wide" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source ./testing/nodes | ||
|
||
echo "Wiping Nodes in reverse order, and rebooting" | ||
ssh $NODE05 "sudo pkill k3s; sudo rm -rf /var/lib/rancher /etc/rancher; sudo reboot" | ||
ssh $NODE04 "sudo pkill k3s; sudo rm -rf /var/lib/rancher /etc/rancher; sudo reboot" | ||
ssh $NODE03 "sudo pkill k3s; sudo rm -rf /var/lib/rancher /etc/rancher; sudo reboot" | ||
ssh $NODE02 "sudo pkill k3s; sudo rm -rf /var/lib/rancher /etc/rancher; sudo reboot" | ||
ssh $NODE01 "sudo pkill k3s; sudo rm -rf /var/lib/rancher /etc/rancher; sudo reboot" | ||
echo | ||
echo "All Control Plane Nodes have been reset" | ||
echo "Consider removing kube-vip images if changing version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $1 && -z $2 && -z $3 && -z $4 ]]; then | ||
echo "Usage:" | ||
echo " Param 1: Kubernetes Version" | ||
echo " Param 2: Kube-Vip Version" | ||
echo " Param 3: Kube-Vip mode [\"controlplane\"/\"services\"/\"hybrid\"]" | ||
echo " Param 4: Vip address" | ||
echo "" | ||
echo "" ./create_k8s.sh 1.18.5 0.3.3 192.168.0.40 | ||
exit 1 | ||
fi | ||
|
||
case "$3" in | ||
|
||
"controlplane") echo "Sending SIGHUP signal" | ||
mode="--controlplane" | ||
;; | ||
"services") echo "Sending SIGINT signal" | ||
mode="--services" | ||
;; | ||
"hybrid") echo "Sending SIGQUIT signal" | ||
mode="--controlplane --services" | ||
;; | ||
*) echo "Unknown kube-vip mode [$3]" | ||
exit -1 | ||
;; | ||
esac | ||
|
||
source ./testing/nodes | ||
|
||
echo "Creating First node!" | ||
|
||
ssh $NODE01 "sudo docker run --network host --rm plndr/kube-vip:$2 manifest pod $mode --interface ens160 --vip $4 --arp --leaderElection | sudo tee /etc/kubernetes/manifests/vip.yaml" | ||
CONTROLPLANE_CMD=$(ssh $NODE01 "sudo kubeadm init --kubernetes-version $1 --control-plane-endpoint $4 --upload-certs --pod-network-cidr=10.0.0.0/16 | grep certificate-key") | ||
ssh $NODE01 "sudo rm -rf ~/.kube/" | ||
ssh $NODE01 "mkdir -p .kube" | ||
ssh $NODE01 "sudo cp -i /etc/kubernetes/admin.conf .kube/config" | ||
ssh $NODE01 "sudo chown dan:dan .kube/config" | ||
echo "Enabling strict ARP on kube-proxy" | ||
ssh $NODE01 "kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e \"s/strictARP: false/strictARP: true/\" | kubectl apply -f - -n kube-system" | ||
ssh $NODE01 "kubectl describe configmap -n kube-system kube-proxy | grep strictARP" | ||
ssh $NODE01 "kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml" | ||
JOIN_CMD=$(ssh $NODE01 " sudo kubeadm token create --print-join-command 2> /dev/null") | ||
|
||
ssh $NODE02 "sudo $JOIN_CMD $CONTROLPLANE_CMD" | ||
sleep 3 | ||
ssh $NODE02 "sudo docker run --network host --rm plndr/kube-vip:$2 manifest pod --interface ens160 --vip $4 --arp --leaderElection $mode | sudo tee /etc/kubernetes/manifests/vip.yaml" | ||
|
||
ssh $NODE03 "sudo $JOIN_CMD $CONTROLPLANE_CMD" | ||
sleep 3 | ||
ssh $NODE03 "sudo docker run --network host --rm plndr/kube-vip:$2 manifest pod --interface ens160 --vip $4 --arp --leaderElection $mode | sudo tee /etc/kubernetes/manifests/vip.yaml" | ||
ssh $NODE04 "sudo $JOIN_CMD" | ||
ssh $NODE05 "sudo $JOIN_CMD" | ||
echo | ||
echo " Nodes should be deployed at this point, waiting 5 secs and querying the deployment" | ||
sleep 5 | ||
ssh $NODE01 "kubectl get nodes" | ||
ssh $NODE01 "kubectl get pods -A" | ||
echo | ||
echo "Kubernetes: $1, Kube-vip $2, Advertising VIP: $4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source ./testing/nodes | ||
|
||
echo "Wiping Nodes in reverse order, and rebooting" | ||
ssh $NODE05 "sudo kubeadm reset -f; sudo rm -rf /etc/cni/net.d; sudo reboot" | ||
ssh $NODE04 "sudo kubeadm reset -f; sudo rm -rf /etc/cni/net.d; sudo reboot" | ||
ssh $NODE03 "sudo kubeadm reset -f; sudo rm -rf /etc/cni/net.d; sudo reboot" | ||
ssh $NODE02 "sudo kubeadm reset -f; sudo rm -rf /etc/cni/net.d; sudo reboot" | ||
ssh $NODE01 "sudo kubeadm reset -f --skip-phases preflight update-cluster-status remove-etcd-member; sudo rm -rf /etc/cni/net.d; sudo reboot" | ||
echo | ||
echo "All Control Plane Nodes have been reset" | ||
echo "Consider removing kube-vip images if changing version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Home lab (for testing) | ||
NODE01=k8s01.fnnrn.me | ||
NODE02=k8s02.fnnrn.me | ||
NODE03=k8s03.fnnrn.me | ||
NODE04=k8s04.fnnrn.me | ||
NODE05=k8s05.fnnrn.me |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters