feat: add cluster auditing, management, and upgrade scripts
This commit is contained in:
21
scripts/audit_cluster_workloads.py
Normal file
21
scripts/audit_cluster_workloads.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import paramiko
|
||||
|
||||
def inspect_cluster(ip, name):
|
||||
print(f"\n=======================================================")
|
||||
print(f"=== {name} WORKLOADS ({ip}) ===")
|
||||
print(f"=======================================================")
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(ip, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
cmd = "kubectl get deploy,sts,ds -A -o custom-columns=NAMESPACE:.metadata.namespace,KIND:.kind,NAME:.metadata.name,IMAGES:.spec.template.spec.containers[*].image"
|
||||
_, out, _ = ssh.exec_command(cmd)
|
||||
lines = out.read().decode().splitlines()
|
||||
for l in lines:
|
||||
if not any(k in l for k in ['kube-system', 'cattle-', 'metallb-system', 'longhorn-system']):
|
||||
print(l)
|
||||
ssh.close()
|
||||
|
||||
inspect_cluster('140.44.4.11', 'AERODROME')
|
||||
inspect_cluster('140.44.4.41', 'SPACEPORT')
|
||||
|
||||
Reference in New Issue
Block a user