<p>Hello I am trying to passing a env values to a job in order to do this I use the following kubernetes template:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: socksdownloader
spec:
  template:
    spec:
      containers:
      - name: socksdownloader
        image: socksdownloader:0.0.1
   #     env:
   #     - name: REDIS_HOST
   #       value: redis
   #     - name: REDIS_PORT
   #       value: 6379
   #     - name: REDIS_DB
   #       value: 0
   #     - name: REDIS_KEY
   #       value: &quot;SOCK:&quot;
        command: [&quot;python&quot;,  &quot;src/main.py&quot;]
      restartPolicy: Never
  backoffLimit: 4
</code></pre>
<p>If I uncoment the env entries of the yml I got the following error:</p>
<blockquote>
<p>The request is invalid: patch: Invalid value:
&quot;map[metadata:map[annotations:map[kubectl.kubernetes.io/last-applied-configuration:{&quot;apiVersion&quot;:&quot;batch/v1&quot;,&quot;kind&quot;:&quot;Job&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;socksdownloader&quot;,&quot;namespace&quot;:&quot;default&quot;},&quot;spec&quot;:{&quot;backoffLimit&quot;:4,&quot;template&quot;:{&quot;spec&quot;:{&quot;containers&quot;:[{&quot;command&quot;:[&quot;python&quot;,&quot;src/main.py&quot;],&quot;env&quot;:[{&quot;name&quot;:&quot;REDIS_HOST&quot;,&quot;value&quot;:&quot;redis&quot;},{&quot;name&quot;:&quot;REDIS_PORT&quot;,&quot;value&quot;:6379},{&quot;name&quot;:&quot;REDIS_DB&quot;,&quot;value&quot;:0},{&quot;name&quot;:&quot;REDIS_KEY&quot;,&quot;value&quot;:&quot;SOCK:&quot;}],&quot;image&quot;:&quot;socksdownloader:0.0.1&quot;,&quot;name&quot;:&quot;socksdownloader&quot;}],&quot;restartPolicy&quot;:&quot;Never&quot;}}}}\n]]
spec:map[template:map[spec:map[]]]]&quot;: cannot convert int64 to string</p>
</blockquote>
<p>The question is how can I pass that values to a Job in order to that can get connection to redis.</p>
<p>Thanks</p>

<p>Kubernetes' <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#envvar-v1-core" rel="noreferrer"><code>envvar</code></a> specification requires environment variable values to be coerced as strings, so integers need to be passed through quote.</p>
<p>Use quotes with the integer values:</p>
<pre><code>- name: REDIS_PORT
  value: &quot;6379&quot;
- name: REDIS_DB
  value: &quot;0&quot;
</code></pre>
