Create a pod on a Kubernetes cluster, wait until the pod stops and collect its logs.

yaml
type: "io.kestra.plugin.kubernetes.core.PodCreate"

Launch a Pod

yaml
id: kubernetes_pod_create
namespace: company.team

tasks:
  - id: pod_create
    type: io.kestra.plugin.kubernetes.core.PodCreate
    namespace: default
    metadata:
      labels:
        my-label: my-value
    spec:
      containers:
      - name: unittest
        image: debian:stable-slim
        command:
          - 'bash'
          - '-c'
          - 'for i in {1..10}; do echo $i; sleep 0.1; done'
      restartPolicy: Never

Launch a Pod with input files and gather its output files.

yaml
id: kubernetes_pod_create
namespace: company.team

inputs:
  - id: file
    type: FILE

tasks:
  - id: pod_create
    type: io.kestra.plugin.kubernetes.core.PodCreate
    spec:
      containers:
      - name: unittest
        image: centos
        command:
          - cp
          - "{{workingDir}}/data.txt"
          - "{{workingDir}}/out.txt"
      restartPolicy: Never
    waitUntilRunning: PT3M
    inputFiles:
      data.txt: "{{inputs.file}}"
    outputFiles:
      - out.txt

Launch a Pod with input files and gather its output files limiting resources for the init and sidecar containers.

yaml
id: kubernetes_pod_create
namespace: company.team

inputs:
  - id: file
    type: FILE

tasks:
  - id: pod_create
    type: io.kestra.plugin.kubernetes.core.PodCreate
    fileSidecar:
      resources:
        limits:
          cpu: "300m"
          memory: "512Mi"
    spec:
      containers:
      - name: unittest
        image: centos
        command:
          - cp
          - "{{workingDir}}/data.txt"
          - "{{workingDir}}/out.txt"
      restartPolicy: Never
    waitUntilRunning: PT3M
    inputFiles:
      data.txt: "{{inputs.file}}"
    outputFiles:
      - out.txt
Properties

The pod specification

Kubernetes pod specification defining containers, volumes, restart policy, and other pod settings. Must include at least one container. Supports dynamic template expressions including the special variable which resolves to '/kestra/working-dir' when inputFiles or outputFiles are used.

The connection parameters to the Kubernetes cluster

If no connection is defined, we try to load the connection from the current context in the following order:

  1. System properties
  2. Environment variables
  3. Kube config file
  4. Service account token and a mounted CA certificate.

You can pass a full configuration with all options if needed.

Default true

Whether to delete the pod after task completion

When true (default), the pod is automatically deleted after successful completion or failure. Set to false to keep the pod for debugging purposes. Note that pods are always deleted when the task is killed.

Default { "image": "busybox" }

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

SubType string

The files to create on the local filesystem – it can be a map or a JSON object.

The files will be available inside the kestra/working-dir directory of the container. You can use the special variable {{workingDir}} in your command to refer to it.

Default false

The pod metadata configuration

Kubernetes metadata for the pod, including labels, annotations, and name. If name is not specified, it will be auto-generated based on the task execution context. Supports dynamic template expressions.

Default default

The namespace where the pod will be created

The Kubernetes namespace in which to create the pod. Defaults to 'default' if not specified.

SubType string

The files from the container filesystem to send to Kestra's internal storage

Only files created inside the kestra/working-dir directory of the container can be retrieved. Must be a list of glob expressions relative to the current working directory, some examples: my-dir/**, my-dir/*/** or my-dir/my-file.txt..

Default true

Whether to resume execution of an existing pod

When true (default), attempts to reconnect to an existing pod with matching taskrun ID and attempt count instead of creating a new pod. This enables recovery from interrupted executions. If no matching pod exists or multiple matching pods are found, a new pod is created.

Default PT30S
Format duration

Additional time to wait for late-arriving logs after pod completion

After the pod completes and initial log collection finishes, wait this duration to capture any remaining logs that may still be in transit. Defaults to 30 seconds. Useful as a safety net for high-throughput scenarios where logs may arrive slightly delayed.

Default PT1H
Format duration

The maximum duration to wait for pod completion

Maximum duration allowed for the pod to complete after reaching Running state. If the pod does not complete within this time, the task will fail and the pod will be deleted. Only used by PodCreate task.

Default PT0S
Format duration

The maximum duration to wait until the resource becomes ready

When set to a positive duration, waits for the resource to report Ready=True in its status conditions. Set to PT0S (zero, default) to skip waiting. Supports Pods, StatefulSets, and custom resources that use the Ready condition. Note: Deployments are not supported as they use the Available condition instead of Ready.

Default PT10M
Format duration

The maximum duration to wait until the pod is running

Maximum time to wait for the pod to reach Running state, including scheduler assignment, image pull, and container startup. Only used by PodCreate task.

The pod metadata

SubType string

The output files URI in Kestra's internal storage

The pod status

The output variables extracted from the logs of the commands

Default v1

The API version

CA certificate as data

CA certificate as file path

Client certificate as data

Client certificate as a file path

Default RSA

Client 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

Default https://kubernetes.default.svc

The URL to the Kubernetes API

The namespace used

Oauth token

Oauth token provider

Password

Trust all certificates

Truststore file

Truststore passphrase

Username

SubType
SubType
SubType
SubType
SubType
Format date-time
Default busybox

The image used for the file sidecar container

The resource requirements applied to the file sidecar container

SubType
SubType string

List of all annotations of the resource

Name of the current cluster

Format date-time

Creation datetime

Deletetion grace period in seconds

Format date-time

Deletion datetime

SubType string

List of finalizers

Generate name of the resource

Generation

SubType string

List of labels

List of managed fields

Name of the resource

Namespace of the resource

List of owner reference

Resource version

Generated UUID of this resource

SubType integer