Files
SnarfCode/scripts/test_spaceport_traefik.py

25 lines
1.0 KiB
Python

import paramiko
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.41', username='root', key_filename=key_path, timeout=10)
# Check curl from spaceport host
stdin, stdout, stderr = ssh.exec_command("curl -k -I https://authentik.snarfnet.net/outpost.goauthentik.io/auth/traefik")
print("Curl from Spaceport host:")
print(stdout.read().decode())
# Check Traefik pod on spaceport
stdin, stdout, stderr = ssh.exec_command("k3s kubectl exec -n kube-system deployment/traefik -- curl -k -I https://authentik.snarfnet.net/outpost.goauthentik.io/auth/traefik 2>/dev/null || true")
print("Curl from Traefik pod on Spaceport:")
print(stdout.read().decode())
# Check Traefik logs on spaceport
stdin, stdout, stderr = ssh.exec_command("k3s kubectl logs -n kube-system deployment/traefik --tail=30 | grep -E 'pihole|authentik|refused' || true")
print("Traefik logs on Spaceport:")
print(stdout.read().decode())
ssh.close()