<p>Here, I have a python file with the name main.py that I want to execute.</p>
<p>The main.py file contains:</p>
<pre><code>import time
import sys
def hello():
    for i in range(10):
         print(“\n”*4, “Hello from AMAN!”, “\n”*4)
         time.sleep(2)
sys.exit(0)
if __name__ == “__main__”:
     hello()
</code></pre>
<p>and I have created a docker image with name Docker file</p>
<pre><code>FROM python:3.7
RUN mkdir /app
WORKDIR /app
ADD . /app/
RUN pip install -r requirements.txt
CMD [“python”, “/app/main.py”]
</code></pre>
<p>I want to know that is there any way to run the python-app image on AWS EKS cluster in pods and get the output <strong>“Hello from AMAN!”</strong> <strong>(whatever this code prints )</strong> back to my system / print it in console .</p>
<p>Since I am not using flask I cannot see the application on web browser so this app will run  in pods ,but I am not able to figure out how to get the output back to the terminal /SSH or in form of some file  .</p>
<p>Please Help me in finding a way to get the output of app running back <strong>without using any web framework</strong> like flask /node etc .</p>

<p>You can use the command</p>
<pre><code>kubectl logs &lt;POD name&gt;
</code></pre>
<p>it show you the output.</p>
<p>If POD running on an EKS you can use different ways to get the logs, write to file, push logs to AWS cloud watch other external logging systems like ELK, using kubectl check logs.</p>
<p>K8s by default store container logs <strong>stdin</strong> and <strong>stdout</strong></p>
