yaml
type: "io.kestra.plugin.kubernetes.kubectl.Apply"
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

yaml
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') }}"

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

yaml
id: apply_and_wait_for_custom_resource
namespace: company.team

tasks:
  - id: apply
    type: io.kestra.plugin.kubernetes.kubectl.Apply
    namespace: default
    waitUntilReady: PT10M
    spec: |-
      apiVersion: example.com/v1
      kind: MyResource
      metadata:
        name: my-resource
      spec:
        foo: bar
Properties
Definitions
apiVersionstring
Defaultv1
caCertDatastring
caCertFilestring
clientCertDatastring
clientCertFilestring
clientKeyAlgostring
DefaultRSA
clientKeyDatastring
clientKeyFilestring
clientKeyPassphrasestring
disableHostnameVerificationbooleanstring
keyStoreFilestring
keyStorePassphrasestring
masterUrlstring
Defaulthttps://kubernetes.default.svc
namespacestring
oauthTokenstring
oauthTokenProvider
outputstring
task
passwordstring
trustCertsbooleanstring
trustStoreFilestring
trustStorePassphrasestring
usernamestring
Default{ "image": "busybox" }
Definitions
defaultSpecobject
imagestring
Defaultbusybox
resourcesobject
SubTypestring
Defaultdefault
SubTypestring
DefaultPT1H
Formatduration
DefaultPT0S
Formatduration
DefaultPT10M
Formatduration
Definitions
annotationsobject
SubTypestring
clusterNamestring
creationTimestampstring
Formatdate-time
deletionGracePeriodSecondsinteger
deletionTimestampstring
Formatdate-time
finalizersarray
SubTypestring
generateNamestring
generationinteger
labelsobject
SubTypestring
managedFieldsarray
apiVersionstring
fieldsTypestring
fieldsV1
managerstring
operationstring
subresourcestring
timestring
namestring
namespacestring
ownerReferencesarray
apiVersionstring
blockOwnerDeletionboolean
controllerboolean
kindstring
namestring
uidstring
resourceVersionstring
selfLinkstring
uidstring