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.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
client.connect(host, username="root", key_filename=SSH_KEY, timeout=10)
|
client.connect(host, username="root", key_filename=SSH_KEY, timeout=10)
|
||||||
|
|
||||||
# Write to remote /tmp/dns-stack.yaml and kubectl apply
|
stdin, stdout, stderr = client.exec_command("k3s kubectl apply -f -")
|
||||||
sftp = client.open_sftp()
|
stdin.write(manifest_content)
|
||||||
with sftp.open("/tmp/dns-stack.yaml", "w") as f:
|
stdin.close()
|
||||||
f.write(manifest_content)
|
|
||||||
sftp.close()
|
|
||||||
|
|
||||||
stdin, stdout, stderr = client.exec_command("k3s kubectl apply -f /tmp/dns-stack.yaml")
|
|
||||||
out = stdout.read().decode()
|
out = stdout.read().decode()
|
||||||
err = stderr.read().decode()
|
err = stderr.read().decode()
|
||||||
client.close()
|
client.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user