Skip to content

k8s list-jobs

Get k8s jobs

Description

Get the kubernetes jobs that satisfies the provided arguments

Synopsis

k8s list-jobs
    [--site <site>]
    [--cluster <cluster>]
    [--namespace|-n <namespace>]
    [<selector>]

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

selector - (string)

     Selector to select the jobs
     Example: "app=k8s,!env"
     Default: _None_      Attributes: optional

Examples

Input:

! k8s list-jobs
Output:
[
    {
        "cluster": "in-cluster",
        "namespace": "default",
        "name": "hello-1632241680",
        "labels": {
            "controller-uid": "6047d70f-9154-4e7e-8dcd-1d0bad4a5059",
            "job-name": "hello-1632241680"
        }
    },
    {
        "cluster": "in-cluster",
        "namespace": "default",
        "name": "hello-1632241740",
        "labels": {
            "controller-uid": "2dad1e38-aa75-4e85-9495-f1bd8f50d823",
            "job-name": "hello-1632241740"
        }
    },
    {
        "cluster": "in-cluster",
        "namespace": "default",
        "name": "hello-1632241800",
        "labels": {
            "controller-uid": "c5195f3c-71d1-46f2-bfc0-e56de80314cf",
            "job-name": "hello-1632241800"
        }
    }
]

Access Control

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

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

Please see Access Control for details.