
Kubernetes
This plugin is only available in the Enterprise Edition (EE).
To generate output files you can:
- Use the
outputFiles property of the task 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 with the
{{outputDir}} Pebble expression or the OUTPUT_DIR environment variable.
When the Kestra Worker running this task is terminated, the pod continues until completion. After restarting, the Worker will resume processing on the existing pod unless resume is set to false.
If your cluster is configured with RBAC, the service account running your pod must have the following authorizations:
pods: get, create, delete, watch, listpods/log: get, watchpods/exec: get, watch
Here is an example role that grants these authorizations:
yamlapiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: task-runner
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "create", "delete", "watch", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get", "watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "watch"]
Enterprise Edition Talk to us
This plugin is only available in the Enterprise Edition (EE).
To generate output files you can:
- Use the
outputFilesproperty of the task 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 with the
{{outputDir}}Pebble expression or theOUTPUT_DIRenvironment variable.
When the Kestra Worker running this task is terminated, the pod continues until completion. After restarting, the Worker will resume processing on the existing pod unless resume is set to false.
If your cluster is configured with RBAC, the service account running your pod must have the following authorizations:
pods: get, create, delete, watch, listpods/log: get, watchpods/exec: get, watch
Here is an example role that grants these authorizations:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: task-runner
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "create", "delete", "watch", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get", "watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "watch"]
Task runner that executes a task inside a pod in a Kubernetes cluster.
This plugin is only available in the Enterprise Edition (EE).
To generate output files you can:
- Use the
outputFilesproperty of the task 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 with the
{{outputDir}}Pebble expression or theOUTPUT_DIRenvironment variable.
When the Kestra Worker running this task is terminated, the pod continues until completion. After restarting, the Worker will resume processing on the existing pod unless resume is set to false.
If your cluster is configured with RBAC, the service account running your pod must have the following authorizations:
pods: get, create, delete, watch, listpods/log: get, watchpods/exec: get, watch
Here is an example role that grants these authorizations:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: task-runner
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "create", "delete", "watch", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get", "watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "watch"]
type: "io.kestra.plugin.ee.kubernetes.runner.Kubernetes"Examples
Execute a Shell command.
id: new-shell
namespace: company.team
tasks:
- id: shell
type: io.kestra.plugin.scripts.shell.Commands
taskRunner:
type: io.kestra.plugin.ee.kubernetes.runner.Kubernetes
commands:
- echo "Hello World"
Pass input files to the task, execute a Shell command, then retrieve output files.
id: new-shell-with-file
namespace: company.team
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.ee.kubernetes.runner.Kubernetes
commands:
- cp {{ workingDir }}/data.txt {{ workingDir }}/out.txt
Properties
configNon-dynamic
The configuration of the target Kubernetes cluster.
io.kestra.plugin.ee.kubernetes.models.Connection
v1The API version
CA certificate as data
CA certificate as file path
Client certificate as data
Client certificate as a file path
RSAClient key encryption algorithm
default is RSA
Client key as data
Client key as a file path
Client key passphrase
Disable hostname verification
Key store file
Key store passphrase
https://kubernetes.default.svcThe url to the Kubernetes API
The namespace used
Oauth token
Oauth token provider
io.kestra.plugin.ee.kubernetes.models.OAuthTokenProvider
Password
Trust all certificates
Truststore file
Truststore passphrase
Username
containerDefaultSpecobject
Default container spec applied to all containers in the pod
When set, these container spec fields are merged into all containers including:
- User-defined containers in the spec
- Init and sidecar containers for file transfer (unless fileSidecar.defaultSpec is set)
This provides a convenient way to apply uniform container settings across all containers, which is especially useful in restrictive environments like GovCloud.
Supports any valid Kubernetes container spec fields such as:
- securityContext: Security settings for all containers
- volumeMounts: Volume mounts to add to all containers
- resources: Resource limits/requests for all containers
- env: Environment variables for all containers
Merge behavior:
- For nested objects (like securityContext): deep merge, container-specific values take precedence
- For lists (like volumeMounts, env): concatenated, with defaults added first
- Container-specific values always override defaults
Example configuration:
containerDefaultSpec:
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: tmp
mountPath: /tmp
resources:
limits:
memory: "256Mi"
containerSpecobject
Additional YAML spec for the container.
deletebooleanstring
trueWhether the pod should be deleted upon completion.
fileSideCarSpecobject
Additional YAML spec for the sidecar container.
fileSidecarNon-dynamic
{
"image": "busybox"
}The configuration of the file sidecar container that handle download and upload of files.
io.kestra.plugin.ee.kubernetes.runner.SideCar
Default container spec for the file sidecar and init containers
Default container spec fields applied to the init and sidecar containers used for file transfer. When set, this overrides containerDefaultSpec for file transfer containers only.
Supports the same fields as containerDefaultSpec:
- securityContext: Security settings for file transfer containers
- volumeMounts: Volume mounts to add to file transfer containers
- resources: Resource limits/requests (note: also available as top-level 'resources' property)
- env: Environment variables for file transfer containers
Example configuration:
fileSidecar:
defaultSpec:
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: tmp
mountPath: /tmp
busyboxThe image used for the file sidecar container.
The resource requirements applied to the file sidecar container
killedNon-dynamic
falsejava.util.concurrent.atomic.AtomicBoolean
labelsobject
The pod custom labels
Kestra will add default labels to the pod with execution and flow identifiers.
namespacestring
defaultThe namespace where the pod will be created.
nodeSelectorobject
Node selector for pod scheduling
Kestra will assign the pod to the nodes you want (see Assign Pod Nodes)
podSpecobject
Additional YAML spec for the pod.
pullPolicystring
ALWAYSIF_NOT_PRESENTALWAYSNEVERThe image pull policy for a container image and the tag of the image, which affect when Docker attempts to pull (download) the specified image.
resourcesNon-dynamic
The pod custom resources
io.kestra.plugin.ee.kubernetes.runner.Kubernetes-Resources
io.kestra.plugin.ee.kubernetes.runner.Kubernetes-Resource
io.kestra.plugin.ee.kubernetes.runner.Kubernetes-Resource
resumebooleanstring
trueWhether to reconnect to the current pod if it already exists.
serviceAccountNamestring
The name of the service account.
syncWorkingDirectorybooleanstring
falseWhether to synchronize working directory from remote runner back to local one after run.
versionNon-dynamicstring
Plugin Version
Defines the version of the plugin to use.
The version must follow the Semantic Versioning (SemVer) specification:
- A single-digit MAJOR version (e.g.,
1). - A MAJOR.MINOR version (e.g.,
1.1). - A MAJOR.MINOR.PATCH version, optionally with any qualifier
(e.g.,
1.1.2,1.1.0-SNAPSHOT).
waitForLogsstring
PT30SdurationThe 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.
waitUntilCompletionstring
PT1HdurationThe maximum duration to wait for the pod completion unless the task timeout property is set which will take precedence over this property.
waitUntilRunningstring
PT10MdurationThe 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.