Files
SnarfCode/scripts/inspect_dns_details.py

31 lines
1.1 KiB
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
def check(host, ns, name):
print(f"\n=================== {name} ({host}) ===================")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(host, username="root", key_filename=key_path, timeout=10)
print("\n--- Pods in ns " + ns + " ---")
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} get pods -o wide")
print(stdout.read().decode('utf-8'))
print("\n--- Pihole Pod describe/logs ---")
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/pihole | grep -E 'Image:|Environment|Mounts|Volumes'")
print(stdout.read().decode('utf-8'))
print("\n--- Technitium Pod describe/logs ---")
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/technitium-dns | grep -E 'Image:|Environment|Mounts|Volumes'")
print(stdout.read().decode('utf-8'))
c.close()
check("140.44.4.11", "infra", "Aerodrome")
check("140.44.4.41", "infrastructure", "Spaceport")