Skip to navigation

Quickstart - CLI

View as MarkdownOpen in Claude

This quickstart shows what the kli CLI is for: seeing which workloads run in a cluster and how each one is structured. You run a JobSet with a leader and workers, then use kli to see which pods play which role. The Karta Operator is not required.

Prerequisites

  • kli installed. For more information, refer to Installation.
  • kubectl, Docker, and kind, to create a local cluster. If you already have a cluster, skip step 1 and use your own kubeconfig.

Quickstart Steps

  1. Create a local cluster:

    kind create cluster --name wm-quickstart
  2. Install the JobSet controller. Replace <version> with a release from the JobSet releases page:

    kubectl apply --server-side -f https://github.com/kubernetes-sigs/jobset/releases/download/<version>/manifests.yaml
    kubectl -n jobset-system wait --for=condition=available deploy/jobset-controller-manager --timeout=240s
  3. Save the following manifest as jobset.yaml. It describes a JobSet with one leader and two workers:

    apiVersion: jobset.x-k8s.io/v1alpha2
    kind: JobSet
    metadata:
    name: my-training
    spec:
    replicatedJobs:
    - name: leader
    replicas: 1
    template:
    spec:
    parallelism: 1
    completions: 1
    template:
    spec:
    restartPolicy: Never
    containers:
    - name: training
    image: busybox:1.36
    command: ["sleep", "600"]
    resources:
    requests:
    cpu: 100m
    memory: 64Mi
    - name: workers
    replicas: 1
    template:
    spec:
    parallelism: 2
    completions: 2
    template:
    spec:
    restartPolicy: Never
    containers:
    - name: training
    image: busybox:1.36
    command: ["sleep", "600"]
    resources:
    requests:
    cpu: 200m
    memory: 128Mi
  4. Submit the JobSet and wait until its pods run:

    kubectl apply -f jobset.yaml
    kubectl get pods

    kubectl lists three pods in one flat list. It does not show which pod is the leader and which are workers.

  5. List the JobSets in the namespace:

    kli get jobsets
    NAME NAMESPACE PHASE AGE
    my-training default Running 26s

    To list the workloads of every type that kli understands, run kli get --all-types.

  6. Describe the workload:

    kli describe jobset/my-training

    The output groups the pods by the role that they play and adds up the resources that each role requests. The pod names and node name in your output are different:

    JobSet/my-training namespace: default definition: jobset-x-k8s-io-jobset-v1alpha2 (catalog) age: 26s
    `-- replicatedjob 3/3 ready wm-quickstart-control-plane
    |-- leader 1/1 ready wm-quickstart-control-plane
    | `-- my-training-leader-0-0-n6lq2 Running wm-quickstart-control-plane
    `-- workers 2/2 ready wm-quickstart-control-plane
    |-- my-training-workers-0-0-q6lp4 Running wm-quickstart-control-plane
    `-- my-training-workers-0-1-xsl2s Running wm-quickstart-control-plane
    Phase: Running
    Resources:
    COMPONENT REPLICAS GPU CPU MEMORY
    leader 1 0 100m 64Mi
    workers 2 0 400m 256Mi
    TOTAL 3 0 500m 320Mi

    Workload Map found the JobSet definition in the catalog that is built into kli. It used the definition to attribute each pod to its role.

    The commands print the warning the kartas.run.ai CRD is not installed; showing built-in definitions only. It means that the cluster has no custom definitions, and you can ignore it.

  7. Delete the cluster:

    kind delete cluster --name wm-quickstart

Next Steps

  • To see the same structure for a manifest that you have not submitted, run kli describe -f jobset.yaml.
  • To learn the terms in the output, refer to Core Concepts.
  • For shell completion and more commands, refer to Inspect Workloads with the CLI.