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?
A Kubernetes job is just a contrainer running. As with any container, the final exit code determines if the run was successful or not. So, to make your job fail you need to exit with a code other than 0.
To resolve it, double check the pod specification and ensure that the repository and image are specified correctly. If this still doesn't work, there may be a network issue preventing access to the container registry. Look in the describe pod text file to obtain the hostname of the Kubernetes node.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With