From 368d9ee28fd7b6da8dc196fe48aea5a29fccf0b6 Mon Sep 17 00:00:00 2001 From: dtookey Date: Tue, 3 Sep 2024 16:00:52 -0400 Subject: [PATCH] cleaned up remaining bugs/typos --- groups/workers | 2 +- kubes/ingress/install.sh | 3 ++- scripts/setup/1-finish-config.sh | 29 +++++++++++++++----------- scripts/setup/output_svc_records.sh | 32 +++++++++++++++++++++++++++++ scripts/setup/reapply.sh | 17 +++++++++++++++ scripts/setup/reformat_x86.sh | 7 +++++-- 6 files changed, 74 insertions(+), 16 deletions(-) create mode 100755 scripts/setup/output_svc_records.sh create mode 100755 scripts/setup/reapply.sh diff --git a/groups/workers b/groups/workers index a1282a0..91e723b 100644 --- a/groups/workers +++ b/groups/workers @@ -1,4 +1,4 @@ cupid1 cupid2 cupid3 -cupid4 \ No newline at end of file +cupid4 diff --git a/kubes/ingress/install.sh b/kubes/ingress/install.sh index 790c0f4..fefdb74 100755 --- a/kubes/ingress/install.sh +++ b/kubes/ingress/install.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#! /usr/local/env bash + PATH_ROOT=~/infra/kubes/ingress cd $PATH_ROOT || exit diff --git a/scripts/setup/1-finish-config.sh b/scripts/setup/1-finish-config.sh index a9b1df3..2d0eafe 100755 --- a/scripts/setup/1-finish-config.sh +++ b/scripts/setup/1-finish-config.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -xe -cd || exit +cd ~/infra || exit # Parse command-line arguments while getopts "n:r:t:" opt; do @@ -16,20 +16,25 @@ if [ -z $JTOKEN ]; then exit fi -parallel -a ./infra/groups/workers ./scripts/setup/kube_worker.sh -n {} -r worker -t $JTOKEN -parallel -a ./infra/groups/compute ./scripts/setup/kube_worker.sh -n {} -r compute -t $JTOKEN +parallel -a groups/workers ./scripts/setup/kube_worker.sh -n {} -r worker -t $JTOKEN +parallel -a groups/compute ./scripts/setup/kube_worker.sh -n {} -r compute -t $JTOKEN -kubectl apply -f infra/kubes/dns/flannel.yaml -kubectl apply -f infra/kubes/dns/kube-dns.yaml +echo "Waiting for 30s for the new pods to settle" +sleep 10 +echo "20s remaining..." +sleep 10 +echo "10s remaining..." +sleep 10 -./infra/kubes/cni/install.sh +kubectl apply -f kubes/dns/flannel.yaml +kubectl apply -f kubes/dns/kube-dns.yaml -kubectl patch deployment coredns -n kube-system --type json --patch "$(cat infra/kubes/dns/coredns-tolerations.json)" -kubectl patch deployment calico-kube-controllers -n kube-system --type json --patch "$(cat infra/kubes/dns/coredns-tolerations.json)" +./kubes/cni/install.sh -./infra/kubes/metallb/install.sh +kubectl patch deployment coredns -n kube-system --type json --patch "$(cat kubes/dns/coredns-tolerations.json)" +kubectl patch deployment calico-kube-controllers -n kube-system --type json --patch "$(cat kubes/dns/coredns-tolerations.json)" -./infra/kubes/ingress/install.sh +./kubes/metallb/install.sh + +./kubes/ingress/install.sh -kubectl apply -f infra/kubes/proofofconcept/poc-deployment.yaml -./infra/kubes/proofofconcept/create-registry-secret.sh diff --git a/scripts/setup/output_svc_records.sh b/scripts/setup/output_svc_records.sh new file mode 100755 index 0000000..c2f8991 --- /dev/null +++ b/scripts/setup/output_svc_records.sh @@ -0,0 +1,32 @@ +#!/bin/bash +kubectl taint nodes cupid1 worker- +echo =========== Create an ubuntu pod ================== +kubectl run ubuntu --image=ubuntu -- bash -c "while true; do echo hello; sleep 10;done" + +# Wait for the pod "ubuntu" to contain the status condition of type "Ready" +kubectl wait --for=condition=Ready pod/ubuntu + +# Save a sorted list of IPs of all of the k8s SVCs: +kubectl get svc -A|egrep -v 'CLUSTER-IP|None'|awk '{print $4}'|sort -V > ips + +# Copy the ip list to owr Ubuntu pod: +kubectl cp ips ubuntu:/ + +echo =========== Installing dig tool into the pod =============== +kubectl exec -it ubuntu -- apt-get update +kubectl exec -it ubuntu -- apt install -y dnsutils + +# Print 7 blank lines +yes '' | sed 7q +echo =========== Print all k8s SVC DNS records ==================== +for ip in $(cat ips); do echo -n "$ip "; kubectl exec -it ubuntu -- dig -x $ip +short; done +echo ====== End of list ===================== + +echo ========= Cleanup =============== +kubectl delete po ubuntu +rm ips + +kubectl taint nodes cupid1 worker=:NoSchedule + +exit 0 + diff --git a/scripts/setup/reapply.sh b/scripts/setup/reapply.sh new file mode 100755 index 0000000..102f740 --- /dev/null +++ b/scripts/setup/reapply.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -xe + +cd ~/infra || exit + +kubectl apply -f kubes/dns/flannel.yaml +kubectl apply -f kubes/dns/kube-dns.yaml + +./kubes/cni/install.sh + +kubectl patch deployment coredns -n kube-system --type json --patch "$(cat kubes/dns/coredns-tolerations.json)" +kubectl patch deployment calico-kube-controllers -n kube-system --type json --patch "$(cat kubes/dns/coredns-tolerations.json)" + +./kubes/metallb/install.sh + +./kubes/ingress/install.sh + diff --git a/scripts/setup/reformat_x86.sh b/scripts/setup/reformat_x86.sh index 35365d7..aa48890 100755 --- a/scripts/setup/reformat_x86.sh +++ b/scripts/setup/reformat_x86.sh @@ -3,5 +3,8 @@ ssh ares "sudo efibootmgr --bootnext 000B > /dev/null" ssh ares "sudo shutdown -r now" -#ssh artemis "sudo efibootmgr --bootnext 000B > /dev/null" -#ssh artemis "sudo shutdown -r now" +ssh -t artemis "sudo kubeadm reset && sudo rm -rf /etc/cni/net.d" +ssh -t cupid1 "sudo kubeadm reset && sudo rm -rf /etc/cni/net.d" +ssh -t cupid2 "sudo kubeadm reset && sudo rm -rf /etc/cni/net.d" +ssh -t cupid3 "sudo kubeadm reset && sudo rm -rf /etc/cni/net.d" +ssh -t cupid4 "sudo kubeadm reset && sudo rm -rf /etc/cni/net.d"