
Kubernetes Restart
CertifiedTrigger rolling restarts for workloads
Kubernetes Restart
Trigger rolling restarts for workloads
Performs a rolling restart on Deployments or StatefulSets in a namespace. waitUntilReady is ignored for this task.
type: io.kestra.plugin.kubernetes.kubectl.RestartExamples
Trigger a rolling restart of a StatefulSet named 'api'.
id: restart_api
namespace: company.team
tasks:
- id: restart
type: io.kestra.plugin.kubernetes.kubectl.Restart
connection:
masterUrl: "{{ secret('MASTER_URL') }}"
caCertData: "{{ secret('CA_CERT_DATA') }}"
oauthToken: "{{ secret('OAUTH_TOKEN') }}"
namespace: api
resourceType: StatefulSet
resourcesNames:
- api
Properties
resourceType *Requiredstring
DeploymentStatefulSetWorkload type
Deployment or StatefulSet.
resourcesNames *Requiredarray
Resource names
Names of workloads to restart in the namespace.
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.
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"
fileSidecar Non-dynamic
{
"image": "busybox"
}The configuration of the file sidecar container that handles the download and upload of files
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.
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.