Failure to create a job in kubernetes due to error

4/21/2017

When creating a Job in kubernetes 1.6, the following error occurs:

Error from server (BadRequest): error when creating "job.yaml": 
Job in version "v1" cannot be handled as a Job: [pos 217]: 
json: expect char '"' but got char '1'

The job.yaml in question is:

apiVersion: batch/v1
kind: Job
metadata:
  name: sysbench-oltp
spec:
  template:
    metadata:
      name: sysbench-oltp
    spec:
      containers:
      - name: sysbench-oltp
        image: sysbench-oltp:1.0
        env:
        - name: OLTP_TABLE_SIZE
          value: 10000
        - name: DB_NAME
          value: "test"
        - name: DB_USER
          value: "test_user"

Any variations on the API do not seem to matter at all. Anybody have any idea of what the problem is?

-- Norbert van Nobelen
kubernetes

1 Answer

4/21/2017

Found the solution:

The JSON parser returns a rather unrelated error on a piece of the data in the environment variables:

   env:
    - name: OLTP_TABLE_SIZE
      value: 10000

Should read:

   env:
    - name: OLTP_TABLE_SIZE
      value: "10000"

After which all the parsing works as it should.

-- Norbert van Nobelen
Source: StackOverflow