Get one or many Kubernetes resources of a kind.

yaml
type: "io.kestra.plugin.kubernetes.kubectl.Get"

Get all pods from Kubernetes using YAML (<=> kubectl get pods).

yaml
id: get_all_pods
namespace: company.team

tasks:
  - id: get
    type: io.kestra.plugin.kubernetes.kubectl.Get
    namespace: default
    resourceType: pods
    fetchType: FETCH

Get one deployment named my-deployment from Kubernetes using YAML (<=> kubectl get deployment my-deployment).

yaml
id: get_one_deployment
namespace: company.team

tasks:
  - id: get
    type: io.kestra.plugin.kubernetes.kubectl.Get
    namespace: default
    resourceType: deployments
    resourcesNames:
      - my-deployment
    fetchType: FETCH_ONE

Get two deployments named my-deployment and my-deployment-2 from Kubernetes using YAML (<=> kubectl get deployment my-deployment) and store them in the internal storage.

yaml
id: get_two_deployments
namespace: company.team

tasks:
  - id: get
    type: io.kestra.plugin.kubernetes.kubectl.Get
    namespace: default
    resourceType: deployments
    resourcesNames:
      - my-deployment
      - my-deployment-2
    fetchType: STORE

Get one custom resource named Shirt from Kubernetes using YAML (<=> kubectl get Shirt).

yaml
id: get_one_custom_resource
namespace: company.team

tasks:
  - id: get
    type: io.kestra.plugin.kubernetes.kubectl.Get
    namespace: default
    resourceType: shirts # could be Shirt
    apiGroup: stable.example.com
    apiVersion: v1
    fetchType: FETCH_ONE

Get a custom resource and wait for it to become ready.

yaml
id: get_and_wait_for_custom_resource
namespace: company.team

tasks:
  - id: get
    type: io.kestra.plugin.kubernetes.kubectl.Get
    namespace: default
    resourceType: myresource
    apiGroup: example.com
    apiVersion: v1
    resourcesNames:
      - my-resource
    fetchType: FETCH_ONE
    waitUntilReady: PT10M
Properties

The Kubernetes resource type (= kind) (e.g., pod, service)

The Kubernetes resource apiGroup

The Kubernetes resource apiVersion

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 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:

text
containerDefaultSpec: 
  securityContext: 
    allowPrivilegeEscalation: false
    capabilities: 
      drop: 
      - ALL
    readOnlyRootFilesystem: true
    seccompProfile: 
      type: RuntimeDefault
  volumeMounts: 
    - name: tmp
      mountPath: /tmp
  resources: 
    limits: 
      memory: "256Mi"
Default NONE
Possible Values
STOREFETCHFETCH_ONENONE
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 default

The namespace where the operation will be done

The Kubernetes namespace in which to execute the operation. 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..

SubType string

The Kubernetes resources names

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 metadata for a single resource

Only available when fetchType is set to FETCH_ONE.

SubType

The metadata for multiple resources

Only available when fetchType is set to FETCH.

The count of the fetched or stored resources

The status for a single resource

Only available when fetchType is set to FETCH_ONE.

The status for multiple resources

Only available when fetchType is set to FETCH.

Format uri

The output files URI in Kestra's internal storage

Only available when fetchType is set to STORE.

Unit records

The number of rows fetch.

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 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

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:

text
fileSidecar: 
  defaultSpec: 
    securityContext: 
      allowPrivilegeEscalation: false
      capabilities: 
        drop: 
        - ALL
      readOnlyRootFilesystem: true
      seccompProfile: 
        type: RuntimeDefault
    volumeMounts: 
      - name: tmp
        mountPath: /tmp
Default busybox

The image used for the file sidecar container

The resource requirements applied to the file sidecar container

The status of the Kubernetes resource

Contains the current state of the resource as a generic map structure