Apply a Kubernetes resource (e.g., a Kubernetes deployment).
type: "io.kestra.plugin.kubernetes.kubectl.apply"Apply a Kubernetes resource, using YAML.
id: create_or_replace_deployment
namespace: company.team
tasks:
  - id: apply
    type: io.kestra.plugin.kubernetes.kubectl.Apply
    namespace: default
    spec: |-
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: mypod
Apply a Kubernetes resource, using a namespace file.
id: create_or_replace_deployment
namespace: company.team
tasks:
  - id: apply
    type: io.kestra.plugin.kubernetes.kubectl.Apply
    namespaceFiles:
      enabled: true
    namespace: default
    spec: "{{ read('deployment.yaml') }}"
Apply a Kubernetes custom resource definition, using YAML.
id: k8s
namespace: company.name
tasks:
  - id: apply
    type: io.kestra.plugin.kubernetes.kubectl.Apply
    namespace: default
    spec: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        name: shirts.stable.example.com
      spec:
        group: stable.example.com
        scope: Namespaced
        names:
          plural: shirts
          singular: shirt
          kind: Shirt
        versions:
        - name: v1
          served: true
          storage: true
          schema:
            openAPIV3Schema:
              type: object
              properties:
                apiVersion:
                  type: string
                kind:
                  type: string
                metadata:
                  type: object
                spec:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true # Allows any fields in spec
                  properties:
                    # You should define your actual Shirt properties here later
                    # For example:
                    # color:
                    #   type: string
                    # size:
                    #   type: string
                    #   enum: ["S", "M", "L", "XL"]
                status:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true # Allows any fields in status
                  properties:
                    # Define your status properties here
                    # message:
                    #   type: string
YESThe Kubernetes resource spec
NOThe 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.
NO{
  "image": "busybox"
}The configuration of the file sidecar container that handle download and upload of files.
YESThe 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.
YESThe Kubernetes namespace
YESThe 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..
YESPT1HdurationThe maximum duration to wait for the job completion.
YESPT10MdurationThe maximum duration to wait until the job and the pod is created.
This timeout is the maximum time that Kubernetes scheduler will take to
- schedule the job
- pull the pod image
- and start the pod.
YESv1The API version
YESCA certificate as data
YESCA certificate as file path
YESClient certificate as data
YESClient certificate as a file path
YESRSAClient key encryption algorithm
default is RSA
YESClient key as data
YESClient key as a file path
YESClient key passphrase
NODisable hostname verification
YESKey store file
YESKey store passphrase
YEShttps://kubernetes.default.svcThe url to the Kubernetes API
YESThe namespace used
YESOauth token
NOOauth token provider
YESPassword
NOTrust all certificates
YESTruststore file
YESTruststore passphrase
YESUsername
NOList of all annotations of the resource
NOName of the current cluster
NOdate-timeCreation datetime
NODeletetion grace period in seconds
NOdate-timeDeletetion datetime
NOList of finalizers
NOGenerate name of the resource
NOGeneration
NOList of labels
NOName of the resource
NONamespace of the resource
NOResource version
NODirect link on the api of this resource
NOGenerated Uid of this resource
NONONONONONONOYESbusyboxThe image used for the file sidecar container.
NONONONONONONONO