when I create the Kubernetes Job by a job yaml file, and I have this error message:
Job in version \"v1\" cannot be handled as a Job: [pos 196]: json: expect char '\"' but got char '{'
Anyone know why? Thanks!
File job.yml:
apiVersion: batch/v1 kind: Job metadata: name: pi labels: name: 09996c3d-cb13-41b0-94a6-b8492d981de5 spec: completions: 1 template: metadata: name: pi labels: name: 09996c3d-cb13-41b0-94a6-b8492d981de5 spec: containers: - name: pi image: perl # command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] env: - name: FUNCTIONGRAPH value: reqJsonBody restartPolicy: OnFailure
The above file perfectly creates a job for me. I am using minikube version minikube version: v0.23.0
and kubectl version 1.8
When I run the command kubectl create -f job.yaml
, output is as follows.
[pgarg@localhost]$ kubectl create -f job.yaml
job "pi" created
[pgarg@localhost]$ oc get pods
NAME READY STATUS RESTARTS AGE
pi-r6xsm 0/1 Completed 0 23s
[pgarg@localhost]$ oc logs pi-r6xsm
Loading DB routines from perl5db.pl version 1.51
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(-e:1): 0
DB<1>
And when I run the same yaml after removing that comment in container's command line. It perfectly prints the value of pi
upto 2000 decimal digit.
I suggest that you upgrade to latest version of minikube if you're not yet on it, or provide some more details.