Cloud Run Job yaml file

Can i create a Cloud Run Job from a manifest yaml file ? any example please if this is possible

Yes, you can use the Cloud Run rest API to create a Job. In the body of your request to the API, you can describe the instance of the Job to be created. While this method is not exactly using YAML, it allows you to save your infrastructure in JSON (subset of YAML).

1 Like

Thank you, i checked the links, i’ll try that then share my update here, seems good, if i get the API response i can write a yaml file out of it

so i made the yaml file out of the response, i tried to apply it in gke even when Cloud Run for Anthos is enabled, it didn’t work,

i got something like Error: name: JOB_NAME namespace: NAMESPACE doesn't have a match in kind: Job apiVersion: run.googleapis.com/v1 ,,, make sure you you install all CRDs

apiVersion: run.googleapis.com/v1
kind: Job
metadata:
  name: logger-job
  namespace: ${PROJECT_NUMBER}
  labels:
    cloud.googleapis.com/location: us-central1
spec:
  template:
    metadata:
      labels:
        client.knative.dev/nonce: xed_kiv_kol
    spec:
      taskCount: 1
      template:
        spec:
          containers:
          - image: gcr.io/${PROJECT_ID}/logger-job
            resources:
              limits:
                memory: 512Mi
                cpu: 1000m
          maxRetries: 5
          timeoutSeconds: '600'
          serviceAccountName: ${PROJECT_NUMBER}-compute@developer.gserviceaccount.com