Skip to content

k8s create-job

create job

Description

create job

Synopsis

k8s create-job
    [--site <site>]
    [--cluster <cluster>]
    [--namespace|-n <namespace>]
    [--image <image>]
    [--command <command>]
    [--command_args <command_args>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Cluster where this command will be executed
     Example: --cluster "in-cluster"
     Default: in-cluster      Attributes: optional

namespace - (string)

     Kubernetes namespace
     Example: --namespace "namespace-1"
     Default: default      Attributes: optional

image - (string)

     Image name for this job
     Example: --image "perl"
     Default: _None_      Attributes: optional

command - (string)

     Command for this job
     Example: --command "perl"
     Default: _None_      Attributes: optional

command_args - (string)

     arg for the command
     Example: --command_args "-Mbignum=bpi"
     Default: _None_      Attributes: optional, multiple allowed

Examples

Input:

!k8s create-job --image "busybox" --command "/bin/sh" --command_args "-c" --command_args "date; echo Hello from the Kubernetes cluster"
Output:
{
    "cluster": "in-cluster",
    "namespace": "default",
    "name": "default",
    "annotations": {
        "autopilot.gke.io/resource-adjustment": "{\"input\":{\"containers\":[{\"name\":\"default\"}]},\"output\":{\"containers\":[{\"limits\":{\"cpu\":\"500m\",\"ephemeral-storage\":\"1Gi\",\"memory\":\"2Gi\"},\"requests\":{\"cpu\":\"500m\",\"ephemeral-storage\":\"1Gi\",\"memory\":\"2Gi\"},\"name\":\"default\"}]},\"modified\":true}"
    },
    "labels": {
        "controller-uid": "1d962783-7c37-4701-af34-3527447858aa",
        "job-name": "default"
    }
}

Access Control

To use this command, you need access to the following:

Field Value
Action "create"
Service Type "k8s"
Service Instance cluster
Namespace namespace
Object Type "job"
Object ID

Please see Access Control for details.