<p>Created a pod using <code>yaml</code> and once pod is created I am running <code>kubectl exec</code> to run my gatling perf test code</p>

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

<p>but this is ending at kubectl console with below message :-</p>

<blockquote>
  <p>command terminated with exit code 137</p>
</blockquote>

<p>On Investigation its found that pod is changing status from running to completed stage.</p>

<p>How do i increase life span of a pod so that it waits for my command to get executed.Here is pod yaml</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>

Margaret real
<p>Here is yaml file to make pod running always
    apiVersion: v1</p>

<pre><code>kind: Pod
metadata:
name: gradlecommandfromcommandline
labels:
purpose: gradlecommandfromcommandline
spec:
volumes:
- name: docker-sock
  hostPath:
    path: /home/vagrant/k8s/pods/gatling/user-files/simulations    # A file or 
directory location on the node that you want to mount into the Pod
  #  command: [ "git clone https://github.com/TarunKDas2k18/PerfGatl.git" ]
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"]

- name: gatlingperftool
  image: tarunkumard/gatling:FirstScript     # Run the ubuntu 16.04
  command: [ "/bin/bash", "-c", "--" ]       # You need to run some task inside a 
  container to keep it running
  args: [ "while true; do sleep 10; done;" ] # Our simple program just sleeps inside 
  an infinite loop
  volumeMounts:
    - mountPath: /opt/gatling/user-files/simulations     # The mount path within the 
  container
      name: docker-sock                   # Name must match the hostPath volume name
  ports:
    - containerPort: 80
</code></pre>
