Kubernetes API (kubectl)
Tasks that perform kubectl-style apply, get, delete, patch, and restart operations.
Tasks that run workloads and kubectl operations against Kubernetes clusters.
Provide cluster connection details (in-cluster, kubeconfig, or explicit server/token/certs) to create pods and stream logs or wait for completion, and run kubectl-style apply/get/patch/delete/restart commands with namespace, context, and resource selectors.
Connect to any cluster — in-cluster or with explicit credentials — to create pods and manage resources from Kestra flows.
Connection details are configured via a connection object on each task. All fields are optional; omitting connection entirely (or leaving masterUrl at its default of https://kubernetes.default.svc) works when Kestra itself runs on Kubernetes and the worker pod has a service account with the required permissions.
For an external cluster, set masterUrl to the cluster API server URL and provide credentials via one of: oauthToken for token-based auth, clientCertData/clientKeyData for certificate auth, or username/password for basic auth. Set caCertData to the cluster's CA certificate to verify the server, or trustAllSsl: true to skip verification. Set namespace on connection to override the default namespace for all operations.
Store credentials in secrets and reference them with {{ secret('...') }}.
core.PodCreate creates a pod, streams its logs, and waits for completion — use it when you need direct control over the pod spec (resource limits, volumes, init containers, node selectors). For simply running a script inside a container as part of a flow, prefer a Kubernetes task runner configured on a script task rather than PodCreate directly.
The kubectl package covers resource management: Apply creates or updates resources from a manifest, Get reads resource state, Patch modifies a live resource, Delete removes it, and Restart triggers a rollout restart. All kubectl tasks accept a namespace property to scope the operation.