<p>This is my <a href="https://kafka.js.org/docs/getting-started" rel="nofollow noreferrer">KafkaJs</a> based publisher client. I created a container image and submitted a <code>Pod</code> YAML to Strimzi broker.</p>
<pre class="lang-js prettyprint-override"><code>const { Kafka } = require('kafkajs')

async function clients() {
const kafka = new Kafka({
  clientId: 'my-app',
  brokers: ['test-kafka-bootstrap.strimzi.svc.cluster.local:9092']
})

const producer = kafka.producer()

await producer.connect()
await producer.send({
  topic: 'clients',
  messages: [
    { value: 'Hello KafkaJS user!' },
  ],
})

await producer.disconnect()
}

clients()
</code></pre>
<p>My <code>Dockerfile</code>.</p>
<pre><code>FROM node:14 as build_app

WORKDIR /

WORKDIR /app
COPY app .
COPY package.json .
COPY package-lock.json .
RUN npm i
CMD [&quot;node&quot;, &quot;index.js&quot;]
</code></pre>
<p>My <code>pod</code> YAML.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: clients
spec:
  containers:
  - name: clients
    image: ghcr.io/org/clients:v0.0.0
    imagePullPolicy: Always
</code></pre>
<p>The <code>Pod</code> keeps crashing and <code>kubectl logs</code> does not show anything - its empty. A <code>kubectl describe</code> didnt' reveal anything either.</p>
<p>What am I missing?</p>

<p>you can bring up the pod in sleep mode and from there you can debug, use below yaml</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: clients
spec:
  containers:
  - name: clients
    image: ghcr.io/org/clients:v0.0.0
    imagePullPolicy: Always
    command: [&quot;sleep&quot; , &quot;100000000&quot;]
</code></pre>
<p>Now exec into the pod</p>
<pre><code>kubectl exec -it &lt;pod&gt; -- bash
</code></pre>
<p>now execute</p>
<pre><code>node index.js
</code></pre>
