KubernetesTaskRunner
KubernetesTaskRunner
This plugin is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.
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.
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.
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
- Type: KubernetesTaskRunner-Resources
- Dynamic: ❌
- Required: ❌
The pod custom resources
Definitions
io.kestra.plugin.kubernetes.runner.KubernetesTaskRunner-Resources
Properties
limit
- Type: KubernetesTaskRunner-Resource
- Dynamic: ❓
- Required: ❌
request
- Type: KubernetesTaskRunner-Resource
- Dynamic: ❓
- Required: ❌
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: ❌