<p>Intention is to execute gatling perf tests from command line .Equivalent docker command is </p>

<pre><code>docker run --rm  -w /opt/gatling-fundamentals/ 
tarunkumard/tarungatlingscript:v1.0 
./gradlew gatlingRun-simulations.RuntimeParameters -DUSERS=500 -DRAMP_DURATION=5 -DDURATION=30
</code></pre>

<p>Now to map above docker run in Kubernetes using kubectl, I have created a pod for which gradlewcommand.yaml file is below</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
name: gradlecommandfromcommandline
labels:
purpose: gradlecommandfromcommandline
spec:
containers:
- name: gradlecommandfromcommandline
image: tarunkumard/tarungatlingscript:v1.0
workingDir: /opt/gatling-fundamentals/
command: ["./gradlew"]
args: ["gatlingRun-simulations.RuntimeParameters", "-DUSERS=500", "- 
DRAMP_DURATION=5", "-DDURATION=30"]
restartPolicy: OnFailure
</code></pre>

<p>Now pod is created using below command:-</p>

<pre><code>kubectl apply -f gradlewcommand.yaml 
</code></pre>

<p>Now comes my actual requirement or question that how do i run or trigger kubectl run command so as to run container inside the above pod created? ,mind you pod name is gradlecommandfromcommandline</p>

<p>Here is the command which solves the problem:</p>

<pre><code> kubectl exec gradlecommandfromcommandline -- \
   ./gradlew gatlingRun-simulations.RuntimeParameters \
   -DUSERS=500 -DRAMP_DURATION=5 -DDURATION=30
</code></pre>
