feat: add cluster management and audit utility scripts
This commit is contained in:
66
scripts/recreate_aero_svc.py
Normal file
66
scripts/recreate_aero_svc.py
Normal file
@@ -0,0 +1,66 @@
|
||||
import paramiko
|
||||
import sys
|
||||
import base64
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("140.44.4.11", username="root", key_filename=key_path, timeout=5)
|
||||
|
||||
cmd = """
|
||||
k3s kubectl -n dns delete svc pihole-dns-vip pihole-web-vip --wait=false
|
||||
sleep 2
|
||||
cat << 'EOF' | k3s kubectl apply -f -
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pihole-dns-vip
|
||||
namespace: dns
|
||||
annotations:
|
||||
metallb.universe.tf/loadBalancerIPs: 140.44.4.32
|
||||
metallb.universe.tf/allow-shared-ip: "aerodrome-dns-key"
|
||||
labels:
|
||||
app: pihole
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: pihole
|
||||
ports:
|
||||
- name: dns-udp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: UDP
|
||||
- name: dns-tcp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pihole-web-vip
|
||||
namespace: dns
|
||||
annotations:
|
||||
metallb.universe.tf/loadBalancerIPs: 140.44.4.32
|
||||
metallb.universe.tf/allow-shared-ip: "aerodrome-dns-key"
|
||||
labels:
|
||||
app: pihole
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: pihole
|
||||
ports:
|
||||
- name: web-http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
EOF
|
||||
sleep 3
|
||||
k3s kubectl -n dns get svc
|
||||
"""
|
||||
stdin, stdout, stderr = c.exec_command(cmd)
|
||||
print(stdout.read().decode('utf-8'))
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user