
Kubernetes Get
CertifiedFetch Kubernetes resources with optional storage
Kubernetes Get
Fetch Kubernetes resources with optional storage
Reads resources of a given kind in a namespace, optionally filtering by name. Supports waiting for readiness, returning data to the flow, or storing results in internal storage depending on fetchType.
type: io.kestra.plugin.kubernetes.kubectl.GetExamples
Get all pods from Kubernetes with a service account and log the status of the pods.
id: get_all_pods
namespace: company.team
tasks:
- id: get
type: io.kestra.plugin.kubernetes.kubectl.Get
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
resourceType: pods
fetchType: FETCH
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.get.statusItems }}"
Get one deployment named 'my-deployment' from Kubernetes with a service account and log the status of the pod.
id: get_one_deployment
namespace: company.team
tasks:
- id: get
type: io.kestra.plugin.kubernetes.kubectl.Get
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
trustCerts: true
namespace: default
resourceType: deployments
resourcesNames:
- my-deployment
fetchType: FETCH_ONE
- id: log_status
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.get.statusItem }}"
Get two deployments named my-deployment and my-deployment-2 from Kubernetes and store them in the internal storage.
id: get_two_deployments
namespace: company.team
tasks:
- id: get
type: io.kestra.plugin.kubernetes.kubectl.Get
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
resourceType: deployments
resourcesNames:
- my-deployment
- my-deployment-2
fetchType: STORE
Get one custom resource named Shirt from Kubernetes.
id: get_one_custom_resource
namespace: company.team
tasks:
- id: get
type: io.kestra.plugin.kubernetes.kubectl.Get
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
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.
id: get_and_wait_for_custom_resource
namespace: company.team
tasks:
- id: get
type: io.kestra.plugin.kubernetes.kubectl.Get
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
resourceType: myresource
apiGroup: example.com
apiVersion: v1
resourcesNames:
- my-resource
fetchType: FETCH_ONE
waitUntilReady: PT10M
Properties
resourceType *Requiredstring
Resource kind
Kubernetes kind (e.g., Pod, Deployment, Service). Case-insensitive.
apiGroup string
API group
Group for the resource kind (empty for core resources).
apiVersion string
API version
Version for the resource kind. Defaults to v1 when omitted.
connection Non-dynamic
Kubernetes connection
Connection settings for the cluster. If omitted, the client resolves credentials in order: system properties, environment variables, kubeconfig, then in-cluster service account.
io.kestra.plugin.kubernetes.models.Connection
v1API version
API group version used by the client. Default v1.
CA certificate data
Base64-encoded PEM CA bundle. Whitespace is stripped automatically.
CA certificate file
Path to a PEM CA bundle.
Client certificate data
Base64-encoded client cert. Whitespace is stripped automatically.
Client certificate file
RSAClient key algorithm
Algorithm for the client key. Default RSA.
Client key data
Base64-encoded client key. Whitespace is stripped automatically.
Client key file
Client key passphrase
Disable hostname verification
Disables TLS hostname checks. Avoid in production clusters.
Keystore file
Keystore passphrase
https://kubernetes.default.svcKubernetes API URL
API server endpoint. Default https://kubernetes.default.svc.
Default namespace
Namespace used when resources omit a namespace.
OAuth token
OAuth token provider
io.kestra.plugin.kubernetes.models.OAuthTokenProvider
PT5MdurationToken cache duration
How long a fetched token is cached before the underlying task is called again. Defaults to 5 minutes. Set to PT0S or a negative duration to disable caching and re-fetch a token on every request.
Password
Trust all certificates
When true, skips TLS cert validation. Use only for testing.
Truststore file
Truststore passphrase
Username
containerDefaultSpec object
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 volumeMounts: concatenated, with defaults added first
- For env: deduplicated by name — container-specific values always win over defaults on collision
- 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"
fetchType string
NONESTOREFETCHFETCH_ONENONEFetch behavior
Determines the output: NONE returns only metrics; FETCH returns lists; FETCH_ONE returns a single item; STORE writes to internal storage and returns URI.
fileSidecar Non-dynamic
{
"image": "busybox"
}The configuration of the file sidecar container that handles the download and upload of files
io.kestra.plugin.kubernetes.models.SideCar
Default spec for file transfer containers
Overrides containerDefaultSpec for the init and sidecar containers that move files. Accepts Pod container fields such as securityContext, volumeMounts, resources, and env; useful for hardening or adding mounts used only by file transfer helpers.
Example: fileSidecar: defaultSpec: securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true volumeMounts: - name: tmp mountPath: /tmp
busyboxImage for file sidecar
Container image used by the init container (uploads input files) and the sidecar (downloads output files). Defaults to busybox.
The image must provide, on its PATH: a POSIX shell (sh), test/[, and sleep — required by the polling script that waits for the transfer to complete before the container exits. find and wc are also used, on a best-effort basis, to verify that uploaded files were fully transferred; if they're missing, verification is skipped rather than failing the task.
Configure sidecar resource requests/limits
Optional Kubernetes resources block applied to the file transfer sidecar.
inheritClusterConfig booleanstring
falseInherit cluster auto-config
When true and a connection is set, the client config is seeded from the ambient auto-config (system properties, env, kubeconfig, in-cluster service account) before applying connection, so a partial connection (e.g. only a namespace) keeps the resolved credentials instead of starting blank. Default false.
inputFiles object
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.
namespace string
defaultThe namespace where the operation will be done
The Kubernetes namespace in which to execute the operation. Defaults to 'default' if not specified.
outputFiles array
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..
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
resourcesNames array
Resource names
Optional list of names to fetch. When empty, all resources of the kind in the namespace are returned.
waitRunning string
PT1HWait for pod completion
Maximum run time after reaching Running (defaults to PT1H). PodCreate fails and deletes the pod when exceeded.
waitUntilReady string
PT0SThe 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.
waitUntilRunning string
PT10MWait for pod to reach Running
Maximum time to reach Running (defaults to PT10M). Covers scheduling, image pulls, and startup. Used by PodCreate.
Outputs
metadataItem
Single metadata
Only available when fetchType is set to FETCH_ONE.
io.kestra.plugin.kubernetes.models.Metadata
Resource annotations
Cluster name
date-timeCreation timestamp
Deletion grace period in seconds
date-timeDeletion timestamp
Finalizers
Generated name prefix
Generation
Resource labels
Managed fields
io.fabric8.kubernetes.api.model.ManagedFieldsEntry
io.fabric8.kubernetes.api.model.FieldsV1
Resource name
Resource namespace
Owner references
io.fabric8.kubernetes.api.model.OwnerReference
Resource version
Self link
Generated UUID of this resource
metadataItems array
Metadata list
Only available when fetchType is set to FETCH.
io.kestra.plugin.kubernetes.models.Metadata
Resource annotations
Cluster name
date-timeCreation timestamp
Deletion grace period in seconds
date-timeDeletion timestamp
Finalizers
Generated name prefix
Generation
Resource labels
Managed fields
io.fabric8.kubernetes.api.model.ManagedFieldsEntry
io.fabric8.kubernetes.api.model.FieldsV1
Resource name
Resource namespace
Owner references
io.fabric8.kubernetes.api.model.OwnerReference
Resource version
Self link
Generated UUID of this resource
size integer
Resource count
statusItem
Single status
Only available when fetchType is set to FETCH_ONE.
io.kestra.plugin.kubernetes.models.ResourceStatus
The status of the Kubernetes resource
Contains the current state of the resource as a generic map structure
statusItems array
Status list
Only available when fetchType is set to FETCH.
io.kestra.plugin.kubernetes.models.ResourceStatus
The status of the Kubernetes resource
Contains the current state of the resource as a generic map structure
uri string
uriStored result URI
Only available when fetchType is set to STORE.
Metrics
fetch.size counter
recordsThe number of rows fetch.