KubernetesTaskRunner KubernetesTaskRunner

yaml
type: "io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner"

Task runner that executes a task inside a pod in a Kubernetes cluster.

This task runner is container-based so the containerImage property must be set to be able to use it.

To access the task's working directory, use the Pebble expression or the WORKING_DIR environment variable. Input files and namespace files will be available in this directory.

To generate output files you can either use the outputFiles task's property and create a file with the same name in the task's working directory, or create any file in the output directory which can be accessed by the Pebble expression or the OUTPUT_DIR environment variables.

Note that when the Kestra Worker running this task is terminated, the pod will still runs until completion, then after restarting, the Worker will resume processing on the existing pod unless resume is set to false.

Examples

Execute a Shell command.

yaml
id: new-shell
namespace: myteam

tasks:
  - id: shell
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner
    commands:
    - echo "Hello World"

Pass input files to the task, execute a Shell command, then retrieve output files.

yaml
id: new-shell-with-file
namespace: myteam

inputs:
  - id: file
    type: FILE

tasks:
  - id: shell
    type: io.kestra.plugin.scripts.shell.Commands
    inputFiles:
      data.txt: "{{inputs.file}}"
    outputFiles:
      - out.txt
    containerImage: centos
    taskRunner:
      type: io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner
    commands:
    - cp {{workingDir}}/data.txt {{workingDir}}/out.txt

Properties

delete

  • Type: boolean
  • Dynamic: ❓
  • Required: βœ”οΈ
  • Default: true

Whether the pod should be deleted upon completion.

namespace

  • Type: string
  • Dynamic: βœ”οΈ
  • Required: βœ”οΈ
  • Default: default

The namespace where the pod will be created.

pullPolicy

  • Type: string
  • Dynamic: ❌
  • Required: βœ”οΈ
  • Default: Always

resume

  • Type: boolean
  • Dynamic: ❓
  • Required: βœ”οΈ
  • Default: true

Whether to reconnect to the current pod if it already exists.

waitForLogs

  • Type: string
  • Dynamic: ❓
  • Required: βœ”οΈ
  • Default: 1.000000000
  • Format: duration

The additional duration to wait for logs to arrive after pod completion.

As logs are not retrieved in real time, we cannot guarantee that we have fetched all logs when the pod complete, therefore we wait for a fixed amount of time to fetch late logs.

waitUntilCompletion

  • Type: string
  • Dynamic: ❓
  • Required: βœ”οΈ
  • Default: 3600.000000000
  • Format: duration

The maximum duration to wait for the pod completion.

waitUntilRunning

  • Type: string
  • Dynamic: ❓
  • Required: βœ”οΈ
  • Default: 600.000000000
  • Format: duration

The maximum duration to wait until the pod is created.

This timeout is the maximum time that Kubernetes scheduler can take to

  • schedule the pod
  • pull the pod image
  • and start the pod.

config

  • Type: Config
  • Dynamic: ❌
  • Required: ❌

The configuration of the target Kubernetes cluster.

fileSidecar

  • Type: SideCar
  • Dynamic: ❌
  • Required: ❌
  • Default: {image=busybox}

The configuration of the file sidecar container that handle download and upload of files.

labels

  • Type: object
  • SubType: string
  • Dynamic: βœ”οΈ
  • Required: ❌

The pod custom labels

Kestra will add default labels to the pod with execution and flow identifiers.

resources

The pod custom resources

Definitions

io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner-Resources

Properties

limit
request

io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner-Resource

Properties

cpu
  • Type: string
  • Dynamic: ❓
  • Required: ❌
memory
  • Type: string
  • Dynamic: ❓
  • Required: ❌

io.kestra.plugin.kubernetes.runner.SideCar

Properties

image
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
  • Default: busybox

The image used for the file sidecar container.

io.kestra.plugin.kubernetes.runner.Config

Properties

caCert
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
clientCert
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
clientKey
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
clientKeyAlgo
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
masterUrl
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
namespace
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
oAuthToken
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
password
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌
trustCerts
  • Type: boolean
  • Dynamic: ❌
  • Required: ❌
  • Default: false
username
  • Type: string
  • Dynamic: βœ”οΈ
  • Required: ❌

Was this page helpful?