Need to run 'exit' command inside Kubernetes pod from terminal when I am logged into the pod

Viewed 232

Hi all, this is my requirement. Please help. My humble request

I am trying to create a pod from Mac terminal and then copy some certificates from terminal to the pod. I am trying to do all this using Python script.

When I create a pod from terminal, I will be logged in to the pod and I will be inside the pod at: [root@mypod /]#

Then I try to exit from the pod using Python command os.system('exit'). I want this 'exit' command to run inside the pod, so that I can be logged out of the pod and then I can copy files from terminal to pod using Python script.

I want all this to happen automatically. Basically I need a solution to run 'exit' command at [root@mypod /]# from the terminal itself.

I heard port-forwarding can be used to achieve this, not sure how it can be done. If any other way also, please let me know. Your help will be greatly appreciated.

0 Answers
Related