<p>container &quot;abc-job&quot; in pod &quot;abc-job-manual-h9k-vbbzw&quot; is waiting to start: CreateContainerConfigError</p>
<p>Error: container has runAsNonRoot and image will run as root (pod: &quot;abc-job-manual-h9k-xyz-ns-nonprod(e38ece94-b411-4d70-bc29-3711f36cfe45)&quot;, container: abc-cron-job)</p>
<p>Below image is from cluser in pod details
<a href="https://i.stack.imgur.com/CU5AP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CU5AP.png" alt="pod details" /></a></p>
<p>below is my yaml file for cronjob</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: abc-cron-job
spec:
  schedule: &quot;10 * * * *&quot;
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: abc-cron-job
            image: docker.repo1.jkl.com/xyz-services/abc/REPLACE_ME
            imagePullPolicy: Always
            env:
            - name: spring-profile
              valueFrom:
                configMapKeyRef:
                  name: spring-profile
                  key: ENV
          restartPolicy: OnFailure     
</code></pre>

<p>in yaml file, securityContext was missing, i added that and now it is working fine. Below one is the updated yaml file</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: abc-cron-job
spec:
  schedule: &quot;10 * * * *&quot;
  jobTemplate:
    spec:
      template:
        spec:
          securityContext:
            runAsGroup: 3000
            runAsUser: 3000
          containers:
          - name: abc-cron-job
            image: docker.repo1.xyz.com/abc-services/abc-application/REPLACE_ME
            imagePullPolicy: Always
            env:
            - name: spring-profile
              valueFrom:
                configMapKeyRef:
                  name: spring-profile
                  key: ENV
            securityContext:
              privileged: false
          restartPolicy: OnFailure

   
</code></pre>
