feat: add cluster auditing, management, and upgrade scripts
This commit is contained in:
20
scripts/inspect_rancher.py
Normal file
20
scripts/inspect_rancher.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
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)
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('kubectl get deployment -n cattle-system rancher -o jsonpath="{.spec.template.spec.containers[0].image}"')
|
||||
print("Rancher image:", stdout.read().decode())
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('kubectl get clusters.management.cattle.io -o custom-columns=NAME:.metadata.name,DISPLAY:.spec.displayName,K8S_VER:.status.version.gitVersion')
|
||||
print("\nRancher Managed Clusters:\n", stdout.read().decode())
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('kubectl get nodes')
|
||||
print("Direct kubectl nodes on Aerodrome:\n", stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user