<p>Used below job.yaml for creating job. Init containers are not getting created.</p>

<p>[root@app]# kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"", GitTreeState:"clean", BuildDate:"2019-10-15T19:07:57Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}</p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  template:
    metadata:
      name: pi
      annotations:
        pod.beta.kubernetes.io/init-containers: '[
          {
            "name": "init-myservice",
            "image": "busybox",
            "command": ["sh", "-c", "until nslookup myservice; do echo waiting for myservice; sleep 2; done;"]
          },
          {
            "name": "init-mydb",
            "image": "busybox",
            "command": ["sh", "-c", "until nslookup mydb; do echo waiting for mydb; sleep 2; done;"]
          }
        ]'
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
</code></pre>

<p>InitContainers are set in the pod spec. Not the metadata. The Pod Spec is the same for Jobs, Deployments, or anything that creates pods.</p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  template:
    metadata:
      name: pi
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      initContainers:
      - name: init-myservice
        image: busybox:1.28
        command: ["sh", "-c", "until nslookup myservice; do echo waiting for myservice; sleep 2; done;"]
      - name: init-mydb
        image: busybox:1.28
        command: ["sh", "-c", "until nslookup mydb; do echo waiting for mydb; sleep 2; done;"]
      restartPolicy: Never
</code></pre>
