feat: add cluster auditing, management, and upgrade scripts
This commit is contained in:
41
scripts/fix_traefik_and_verify.py
Normal file
41
scripts/fix_traefik_and_verify.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import paramiko
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=8)
|
||||
|
||||
print("=== FIXING TRAEFIK CRD LABELS & ANNOTATIONS ===")
|
||||
annotate_cmd = """
|
||||
for crd in $(kubectl get crd -o name | grep 'traefik.io'); do
|
||||
echo "Patching $crd..."
|
||||
kubectl annotate $crd meta.helm.sh/release-name=traefik-crd meta.helm.sh/release-namespace=kube-system --overwrite
|
||||
kubectl label $crd app.kubernetes.io/managed-by=Helm --overwrite
|
||||
done
|
||||
"""
|
||||
stdin, stdout, stderr = ssh.exec_command(annotate_cmd)
|
||||
print(stdout.read().decode())
|
||||
|
||||
print("=== DELETING FAILED HELM INSTALL JOBS TO RETRIGGER ===")
|
||||
ssh.exec_command('kubectl delete job -n kube-system helm-install-traefik-crd helm-install-traefik')
|
||||
|
||||
print("Waiting 15 seconds for Helm controller to reconcile...")
|
||||
time.sleep(15)
|
||||
|
||||
print("=== CHECKING LONGHORN-MANAGER ON WRK01 ===")
|
||||
_, out, _ = ssh.exec_command('kubectl get pods -n longhorn-system -l app=longhorn-manager -o wide')
|
||||
print(out.read().decode())
|
||||
|
||||
print("=== CHECKING ALL PODS IN KUBE-SYSTEM ===")
|
||||
_, out, _ = ssh.exec_command('kubectl get pods -n kube-system | grep traefik')
|
||||
print(out.read().decode())
|
||||
|
||||
print("=== CHECKING ANY REMAINING CRASHING PODS ===")
|
||||
_, out, _ = ssh.exec_command('kubectl get pods -A | grep -v Running | grep -v Completed')
|
||||
print(out.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user