22 lines
779 B
Python
22 lines
779 B
Python
import paramiko
|
|
import json
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
_, out, err = ssh.exec_command('kubectl get pod -n infrastructure -l app.kubernetes.io/name=coder -o json')
|
|
pod = json.loads(out.read().decode())
|
|
if pod.get('items'):
|
|
container = pod['items'][0]['spec']['containers'][0]
|
|
print("Image:", container.get('image'))
|
|
print("Env:")
|
|
for e in container.get('env', []):
|
|
print(f" {e.get('name')}: {e.get('value', e.get('valueFrom'))}")
|
|
print("VolumeMounts:")
|
|
for vm in container.get('volumeMounts', []):
|
|
print(f" {vm.get('name')} -> {vm.get('mountPath')}")
|
|
|
|
ssh.close()
|
|
|