Files
SnarfCode/scripts/inspect_rancher_installation.py

27 lines
931 B
Python

import paramiko
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=10)
def run(cmd):
print(f"\n=== {cmd} ===")
_, out, err = ssh.exec_command(cmd)
res = out.read().decode('utf-8', errors='replace').strip()
if res:
print(res)
e = err.read().decode('utf-8', errors='replace').strip()
if e:
print("ERR:", e)
run("kubectl get deploy,sts,ds -n cattle-system -o wide")
run("kubectl get pods -n cattle-system -o wide")
run("kubectl get deploy -n cattle-system rancher -o yaml | grep -E 'image:'")
run("kubectl get secrets -n cattle-system | grep -i helm")
run("kubectl get helmcharts,helmchartconfigs -A | grep -i rancher")
run("kubectl get ns | grep -E 'cert-manager|cattle'")
run("kubectl get pods -n cert-manager 2>/dev/null || true")
ssh.close()