I am using paramiko python package to run kubectl commands on remote server. My target to send current file to kubernetes pod which runs on external server only. But exec_command
not doing this for me. Is it I am trying in wrong way? :
import os
import paramiko
ssh = SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('server', port, userid, password)
client.exec_command("kubectl config use-context namespace")
client.exec_command("kubectl scale statefulsets rbatch --replicas=1")
client.exec_command("kubectl cp openings.csv namespace/rbatch-0:/srv/batch/source")
I appreciate if anyone can guide me