Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes Job in version "v1" cannot be handled as a Job:

Tags:

kubernetes

I'm trying to create a migration but it's failing with the below error:

Error from server (BadRequest): error when creating "kubernetes/migration-job.yaml": Job in version "v1" cannot be handled as a Job: v1.Job: Spec: v1.JobSpec:

What is the cause of this error?

like image 658
Chris Stryczynski Avatar asked Jan 16 '19 17:01

Chris Stryczynski


People also ask

How do I manually run Kubernetes job?

To manually run a CronJob as a Job you run the kubectl create job command. You then specify the CronJob to base the job off of using the --from flag. Lastly, you specify a unique name for the job.

What is a job in Kubernetes?

A Job creates one or more Pods and will continue to retry execution of the Pods until a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions.


1 Answers

The issue was to do with one of the yaml fields:

env:
  - name: DB_HOST
    value: "mysql"
  - name: DB_PORT
    value: 3306

3306 should be a string ("3306") instead...

like image 177
Chris Stryczynski Avatar answered Oct 01 '22 09:10

Chris Stryczynski