Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

qsub for Kubernetes

CircleCI codecov

qsub is a command line tool for submitting batch jobs to a workload manager. Its basic functionality is described and specified in the POSIX standard. Several HPC job schedulers (like Univa Grid Engine) provide a qsub command line utility enhanced with an huge amount of extensions.

Container orchestrators like Kubernetes provide other mechanisms to submit batch jobs. Typically yaml files describing the job are used along with kubectl.

This repository provides a simple imperative job submission command line alternative for Kubernetes.


qsub can be build directly (GO111MODULE=on) from the sources or alternatively pre-build binaries for darwin and linux can be downloaded from the builds dir.


In order to let the sleep command run in the Kubernetes cluster which is selected in the current context (./kube/config) you need to specify the container image as well as the command to be executed in the container (potentially with its arguments).

qsub --image busybox:latest sleep 123

It returns the ID of the job.

The container image can also be set beforehand as environment variable.

export QSUB_IMAGE=busybox:latest
qsub sleep 123

The corresponding pods can be showed with the ID returned back on command line:

kubectl describe pod -l job-name=ID

More Arguments

The image name (--img) as well as the command which should be executed in the container derived from the image are mandatory.

Following optional arguments are currently available.

Job Name

The job name must be unique otherwise job submission will fail.

qsub --image busybox:latest -N unique sleep 123
Submitted job with ID unique

kubectl get jobs unique
unique 1         0            14s   


Jobs can be submitted to a specific kubernetes namespace.

qsub --namespace default --image busybox:latest sleep 123


Kubernetes allows to attach labels to pods. Labels are key-value pairs which can be defined with the -l argument.

Environment Variables

Environment variables for the jobs can be set by passing them into -v. There are two ways of doing so: as key-value pairs, or just by name.

Following example sets ENV1 to VALUE1 and ENV2 to VALUE2 (using the value from the current context).

export ENV2=VALUE2
qsub --image busybox:latest -v ENV1=VALUE1,ENV2 sleep 123


In order to let the job be scheduled by a non-default scheduler (like poseidon or kube-batch) the --scheduler argument can be used.

qsub --scheduler poseidon --img busybox:latest sleep 123