<p>I have been searching web to execute a command in a Kubernetes pod using my java application.
The results were blurry, Hence I would like to know If there is a way for a java application running in one pod to execute a command on another pod ?</p>

R_S_C
<blockquote>
<p>[Is] there is a way for a java application running in one pod to execute a command on another pod?</p>
</blockquote>
<p>No.  You need to create a network interface to the second application and make gRPC or HTTP calls to it, or build both programs into the same image so that you can launch the second program as an ordinary subprocess.</p>
<p>This is true of containers in general.  You'd have the same problem trying to run the two parts in non-Kubernetes Docker containers (recommended for experimentation and development) or running two containers in the same Kubernetes pod (not recommended).</p>
<p>(There's a &quot;but&quot; involving using the Kubernetes API, but this is a rather complex setup, it involves Kubernetes-specific code in your application, and it requires service-account and permissions setup in the Kubernetes deployment.  I'd avoid that, especially for your application's core data flow.)</p>
