Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
How to use env values to Job?

Hello I am trying to passing a env values to a job in order to do this I use the following kubernetes template:

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: "SOCK:"
        command: ["python",  "src/main.py"]
      restartPolicy: Never
  backoffLimit: 4

If I uncoment the env entries of the yml I got the following error:

The request is invalid: patch: Invalid value: "map[metadata:map[annotations:map[kubectl.kubernetes.io/last-applied-configuration:{"apiVersion":"batch/v1","kind":"Job","metadata":{"annotations":{},"name":"socksdownloader","namespace":"default"},"spec":{"backoffLimit":4,"template":{"spec":{"containers":[{"command":["python","src/main.py"],"env":[{"name":"REDIS_HOST","value":"redis"},{"name":"REDIS_PORT","value":6379},{"name":"REDIS_DB","value":0},{"name":"REDIS_KEY","value":"SOCK:"}],"image":"socksdownloader:0.0.1","name":"socksdownloader"}],"restartPolicy":"Never"}}}}\n]] spec:map[template:map[spec:map[]]]]": cannot convert int64 to string

The question is how can I pass that values to a Job in order to that can get connection to redis.

Thanks

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Kubernetes' envvar specification requires environment variable values to be coerced as strings, so integers need to be passed through quote.

Use quotes with the integer values:

- name: REDIS_PORT
  value: "6379"
- name: REDIS_DB
  value: "0"
over 4 years ago · Santiago Trujillo Report

0

For the port it needs to be value: "6379" and similar for the DB. YAML automatically guesses if something looks like a number but environment variables must be strings. Hence "cannot convert int64 to string".

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!