Search code examples
dockerkubernetesarguments

Why are command arguments passed to the pod causing issues?


PROBLEM SUMMARY:

I'm trying to use the docker image at https://hub.docker.com/r/tooldockers/iops. The Pod and PVC yaml written and both resources created. However, pod creation fails and crashes/backs off; below are the errors from the pod log. I took what seemed correct from the Dockerfile and a working example of docker run, and am trying to figure out why I'm still getting these errors in the log.

$ k logs bm
fio: unrecognized option: rm
fio: unrecognized option '--rm'
Did you mean rw?

DESCRIPTION:

This is yaml for the pod:

apiVersion: v1
kind: Pod
metadata:
  name: bm 
  namespace: io-benchmark 
spec:
  volumes:
  - name: data
    persistentVolumeClaim:
      claimName: io-benchmark-pvc
  containers:
  - name: burvil-test-app
    image: tooldockers/iops 
    command: ["docker-entrypoint.sh"]
    args: [ "--rm", "-v", "`pwd`/data:/iops/data", "tooldockers/iops", "--randrepeat=1", "--ioengine=libaio", "--direct=1", "--gtod_reduce=1", "--name=test", "--filename=test", "--bs=4k", "--iodepth=64", "--size=10M", "--readwrite=randrw", "--rwmixread=75"]
    volumeMounts:
    - mountPath: /data
      name: data 

The command and args in the yaml are based on the following:

  1. command: taken from the Dockerfile at https://github.com/tool-dockers/docker-iops/blob/master/Dockerfile, where ENTRYPOINT would be the command that should be specified in the pod yaml, which is docker-entrypoint.sh
  2. args: taken from the example command from https://github.com/tool-dockers/docker-iops for Random read/write; I ran that command successfully below on the same system I'm trying to launch my pod from (see output below).

The args for the pod yaml are taken from the example docker run command in https://github.com/tool-dockers/docker-iops, i.e. where I ran the same command (changing only the size) successfully:

$ docker run --rm -v `pwd`/data:/iops/data tooldockers/iops --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=10M --readwrite=randrw --rwmixread=75
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.16
Starting 1 process
test: Laying out IO file (1 file / 10MiB)

test: (groupid=0, jobs=1): err= 0: pid=10: Wed Dec 27 04:56:23 2023
  read: IOPS=27.6k, BW=108MiB/s (113MB/s)(7628KiB/69msec)
  write: IOPS=9463, BW=36.0MiB/s (38.8MB/s)(2612KiB/69msec); 0 zone resets
  cpu          : usr=5.88%, sys=67.65%, ctx=12, majf=0, minf=26
  IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.3%, 16=0.6%, 32=1.2%, >=64=97.5%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwts: total=1907,653,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
   READ: bw=108MiB/s (113MB/s), 108MiB/s-108MiB/s (113MB/s-113MB/s), io=7628KiB (7811kB), run=69-69msec
  WRITE: bw=36.0MiB/s (38.8MB/s), 36.0MiB/s-36.0MiB/s (38.8MB/s-38.8MB/s), io=2612KiB (2675kB), run=69-69msec

I try both:

  • removing the line for command: and recreating the pod
  • replacing the command: argument with ["/bin/sh -xv docker-entrypoint.sh"]

but still get the same results. From what I can tell for the code at https://github.com/tool-dockers/docker-iops/blob/master/docker-entrypoint.sh, the args I specify in args: in the pod yaml should just be passed as arguments into docker-entrypoint.sh, i.e. same as what's happening for the working docker run command. What am I missing here?


Solution

  • What you're passing as the command is going into the container, not to run the container.

    If you were to compare this to a normal docker command like your example, then you'd need the latter part.

    What you have in the Kubernetes yaml is equivalent to the following:

    $ docker run -ti --rm tooldockers/iops --rm -v <cropped the rest cause it doesn't matter>
    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
    fio: unrecognized option: rm
    fio: unrecognized option '--rm'
    Did you mean rw?
    
    

    As you can see, the result is the same.

    Your yaml needs to looks like so:

    apiVersion: v1
    kind: Pod
    metadata:
      name: bm 
      namespace: io-benchmark 
    spec:
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: io-benchmark-pvc
      containers:
      - name: burvil-test-app
        image: tooldockers/iops 
        args: [ "--randrepeat=1", "--ioengine=libaio", "--direct=1", "--gtod_reduce=1", "--name=test", "--filename=test", "--bs=4k", "--iodepth=64", "--size=10M", "--readwrite=randrw", "--rwmixread=75"]
        volumeMounts:
        - mountPath: /data
          name: data 
    

    Where you just pass the arguments to the container in the pod, like you would when running the container on the CLI, which should yield the expected result:

    $ oc logs -f bm
    test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
    fio-3.16
    Starting 1 process
    test: Laying out IO file (1 file / 10MiB)
    
    test: (groupid=0, jobs=1): err= 0: pid=41: Wed Dec 27 20:22:24 2023
      read: IOPS=100k, BW=392MiB/s (411MB/s)(7628KiB/19msec)
      write: IOPS=34.4k, BW=134MiB/s (141MB/s)(2612KiB/19msec); 0 zone resets
      cpu          : usr=33.33%, sys=22.22%, ctx=89, majf=0, minf=70
      IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.3%, 16=0.6%, 32=1.2%, >=64=97.5%
         submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
         complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
         issued rwts: total=1907,653,0,0 short=0,0,0,0 dropped=0,0,0,0
         latency   : target=0, window=0, percentile=100.00%, depth=64
    
    Run status group 0 (all jobs):
       READ: bw=392MiB/s (411MB/s), 392MiB/s-392MiB/s (411MB/s-411MB/s), io=7628KiB (7811kB), run=19-19msec
      WRITE: bw=134MiB/s (141MB/s), 134MiB/s-134MiB/s (141MB/s-141MB/s), io=2612KiB (2675kB), run=19-19msec