<p>&quot;I just want to run a cronjob in Kubernetes in every 10 seconds.  what would be the imperative command for that?&quot;</p>

<p>You can’t use CronJob kubernetes object for running less than 1 minute. You might be using the wrong tool for a process that has to run so often. <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/</a></p>
<h1>Create an infinite loop on a Deployment (daemonize it)</h1>
<p>You’ll need to use a bash formula (or whatever programming language you like best, Go, Java, Python or Ruby) to make an infinite loop and sleep 10 seconds per each execution inside a Deployment. Here an example with bash/sh:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: cronjob-deployment
  labels:
    app: cronjob
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cronjob
  template:
    metadata:
      labels:
        app: cronjob
    spec:
      containers:
      - name: cronjob
        image: busybox
        args:
        - /bin/sh
        - -c
        - while true; do echo call ./script.sh here; sleep 10; done
</code></pre>
<h1>Create 1 CronJob with several containers</h1>
<p>If you still want to use CronJobs you can do it with 6 containers inside the definition. One without delay, and the others with 10, 20, 30, 40 and 50 seconds of delay.</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: &quot;*/1 * * * *&quot;
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: no_delay
            image: busybox
            args:
            - /bin/sh
            - -c
            - echo call ./script.sh here
          - name: 10_seconds
            image: busybox
            args:
            - /bin/sh
            - -c
            - sleep 10; echo call ./script.sh here
          - name: 20_seconds
            image: busybox
            args:
            - /bin/sh
            - -c
            - sleep 20; echo call ./script.sh here
          - name: 30_seconds
            image: busybox
            args:
            - /bin/sh
            - -c
            - sleep 30; echo call ./script.sh here
          - name: 40_seconds
            image: busybox
            args:
            - /bin/sh
            - -c
            - sleep 40; echo call ./script.sh here
          - name: 50_seconds
            image: busybox
            args:
            - /bin/sh
            - -c
            - sleep 50; echo call ./script.sh here
          restartPolicy: OnFailure
</code></pre>
<p>Of course, one of the problems you might encounter is that your process might be overlapped (runned concurrently at the same time). This will depend on the amount of seconds your process needs to run, and the time kubernetes needs to schedule and create a container.</p>
