feat: add infrastructure audit and diagnostic helper scripts
This commit is contained in:
25
scripts/cleanup_spaceport_svclb.py
Normal file
25
scripts/cleanup_spaceport_svclb.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import paramiko
|
||||
|
||||
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.41', username='root', key_filename=key_path, timeout=10)
|
||||
|
||||
with open(r'homelab-gitops-repo/manifests/spaceport/dns/dns-stack.yaml', 'r') as f:
|
||||
manifest_content = f.read()
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('k3s kubectl apply -f -')
|
||||
stdin.write(manifest_content)
|
||||
stdin.channel.shutdown_write()
|
||||
print("Apply:", stdout.read().decode())
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('k3s kubectl delete svc -n dns pihole-web-vip 2>/dev/null || true')
|
||||
print("Delete old svc:", stdout.read().decode())
|
||||
|
||||
# Check pending pods on Spaceport now
|
||||
stdin, stdout, stderr = ssh.exec_command("k3s kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded --no-headers")
|
||||
print("Pending/failing pods on Spaceport:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user