<p>My requirement is to start a pod when a particular batch job is completed. </p>

<p>Batch job yaml file </p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: topics
spec:
  ttlSecondsAfterFinished: 100
  template:
    metadata:
      labels:
        app: topics
    spec:
      containers:
      - env:
        name: topics
        image: confluentinc/cp-kafka:5.3.0
        command:
        - sh
        - -c
        - {{.Values.KafkaTopics}}
</code></pre>

<p>2 Deployment yaml </p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: opp
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      labels:
        app: opp

      initContainers:
      - name: init
        image: busybox
        command: ['sh', '-c', 'until nc -z someservice:8093; do echo waiting for init; sleep 2; done;']
</code></pre>

<p>Init container fine when I am checking for some service to be up. Not able to figure it out for batch job. </p>

pythonhmmm
<blockquote>
  <p>start a pod</p>
</blockquote>

<p>What you have described with a <code>Deployment</code> is a <strong>deployment of a service</strong>, not only <em>starting</em> a pod.</p>

<h2>Watch status of Kubernetes objects</h2>

<blockquote>
  <p>when a particular batch job is completed.</p>
</blockquote>

<p>If you want to watch Kubernetes objects and do actions depending on change of status of a particular object, you need to interact with the Kubernetes API server.</p>

<p><strong>Use a Kubernetes client</strong></p>

<p>The easiest way to interact with the Kubernetes API, especially for <em>watch</em> is to use a pre-built client, e.g. <a href="https://github.com/kubernetes/client-go" rel="nofollow noreferrer">client-go</a> or <a href="https://github.com/kubernetes-client/java" rel="nofollow noreferrer">kubernetes-client Java</a>.</p>

<p><strong>Use the Kubernetes REST API</strong></p>

<p>Alternatively you can use the <a href="https://kubernetes.io/docs/concepts/overview/kubernetes-api/" rel="nofollow noreferrer">Kubernetes REST API</a> directly.</p>

<p><strong>API Authentication and Authorization</strong></p>

<p>Beware that you should use a <em>Service Account</em> for authentication and set properly RBAC rules for authorization.</p>

<h2>Kafka Consumer</h2>

<p>An alternative solution, since your <code>Job</code> hints that you are using Kafka. Your <code>Job</code> could publish an event on Kafka, and you can have a <em>Kafka Consumer</em> to <em>subscribe</em> and act upon those events. But if the consumer should <em>deploy</em> a service on an event, it also need an <em>Service Account</em> to interact with the Kubernetes API server.</p>
