Delete one or many Kubernetes resources of a kind.
type: "io.kestra.plugin.kubernetes.kubectl.Delete"Examples
Delete a list of pods from Kubernetes using YAML (<=> kubectl delete pod my-pod my-pod-2).
id: delete_pods
namespace: company.team
tasks:
- id: delete
type: io.kestra.plugin.kubernetes.kubectl.Delete
namespace: default
resourceType: pods
resourcesNames:
- my-pod
- my-pod-2
Properties
resourceType *Requiredstring
The Kubernetes resource type (= kind) (e.g., pod, service)
resourcesNames *Requiredarray
The Kubernetes resources names
apiGroup string
The Kubernetes resource apiGroup
apiVersion string
The Kubernetes resource apiVersion
connection Non-dynamicConnection
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:
- System properties
- Environment variables
- Kube config file
- Service account token and a mounted CA certificate.
You can pass a full configuration with all options if needed.
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 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"
fileSidecar Non-dynamicSideCar
{
"image": "busybox"
}The configuration of the file sidecar container that handles the download and upload of files
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..
waitRunning string
PT1HdurationThe 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.
waitUntilReady string
PT0SdurationThe 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
PT10MdurationThe 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.
Definitions
io.kestra.plugin.kubernetes.models.Connection
apiVersion string
v1The API version
caCertData string
CA certificate as data
caCertFile string
CA certificate as file path
clientCertData string
Client certificate as data
clientCertFile string
Client certificate as a file path
clientKeyAlgo string
RSAClient key encryption algorithm
default is RSA
clientKeyData string
Client key as data
clientKeyFile string
Client key as a file path
clientKeyPassphrase string
Client key passphrase
disableHostnameVerification booleanstring
Disable hostname verification
keyStoreFile string
Key store file
keyStorePassphrase string
Key store passphrase
masterUrl string
https://kubernetes.default.svcThe URL to the Kubernetes API
namespace string
The namespace used
oauthToken string
Oauth token
oauthTokenProvider OAuthTokenProvider
Oauth token provider
password string
Password
trustCerts booleanstring
Trust all certificates
trustStoreFile string
Truststore file
trustStorePassphrase string
Truststore passphrase
username string
Username
io.kestra.plugin.kubernetes.models.SideCar
defaultSpec object
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
image string
busyboxThe image used for the file sidecar container
resources object
The resource requirements applied to the file sidecar container