0

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

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

but this is ending at kubectl console with below message :-

command terminated with exit code 137

On Investigation its found that pod is changing status from running to completed stage.

How do i increase life span of a pod so that it waits for my command to get executed.Here is pod yaml

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
Ami Hollander
  • 2,435
  • 3
  • 29
  • 47
Margaret real
  • 329
  • 1
  • 6
  • 14
  • Can you add details as to what is that Pod is doing and why does it finish so quickly or what you are trying to achieve , Maybe you might have a better chance of running the script inside within the pod rather than doing it as kubectl exec... – fatcook Dec 13 '18 at 05:44
  • you can make the pod running continuously [look here](https://stackoverflow.com/a/40093356/5833562), then exec into the pod, check what is happening with your command - running it manually – sanster_23 Dec 13 '18 at 09:58
  • Thanks @sanster_23 your solution worked,also thanks to fatcook also for response – Margaret real Dec 13 '18 at 14:55

1 Answers1

2

Here is yaml file to make pod running always apiVersion: v1

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
Margaret real
  • 329
  • 1
  • 6
  • 14