feat: add script to apply DNS manifests via SSH to cluster nodes
This commit is contained in:
@@ -10,13 +10,9 @@ def apply_manifest(host, local_file):
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(host, username="root", key_filename=SSH_KEY, timeout=10)
|
||||
|
||||
# Write to remote /tmp/dns-stack.yaml and kubectl apply
|
||||
sftp = client.open_sftp()
|
||||
with sftp.open("/tmp/dns-stack.yaml", "w") as f:
|
||||
f.write(manifest_content)
|
||||
sftp.close()
|
||||
|
||||
stdin, stdout, stderr = client.exec_command("k3s kubectl apply -f /tmp/dns-stack.yaml")
|
||||
stdin, stdout, stderr = client.exec_command("k3s kubectl apply -f -")
|
||||
stdin.write(manifest_content)
|
||||
stdin.close()
|
||||
out = stdout.read().decode()
|
||||
err = stderr.read().decode()
|
||||
client.close()
|
||||
|
||||
Reference in New Issue
Block a user