Apply Apply

yaml
type: "io.kestra.plugin.kubernetes.kubectl.Apply"

Apply a Kubernetes resource

Examples

Apply a Kubernetes resource, using YAML.

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.

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

Properties

spec

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The Kubernetes resource spec

waitRunning

  • Type: string
  • Dynamic:
  • Required: ✔️
  • Default: 3600.000000000
  • Format: duration

The maximum duration to wait for the job completion.

waitUntilRunning

  • Type: string
  • Dynamic:
  • Required: ✔️
  • Default: 600.000000000
  • Format: duration

The 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.

connection

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:

  1. System properties
  2. Environment variables
  3. Kube config file
  4. Service account token and a mounted CA certificate.

You can pass a full configuration with all options if needed.

fileSidecar

  • Type: SideCar
  • Dynamic:
  • Required:
  • Default: {image=busybox}

The configuration of the file sidecar container that handle download and upload of files.

inputFiles

  • Type: object
  • SubType: string
  • Dynamic: ✔️
  • Required:

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

  • Type: string
  • Dynamic: ✔️
  • Required:

The Kubernetes namespace

outputFiles

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

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..

Outputs

metadata

  • Type: array
  • SubType: Metadata
  • Required:

The pod metadata.

Definitions

io.kestra.plugin.kubernetes.models.Connection

Properties

apiVersion
  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: v1

The API version

caCertData
  • Type: string
  • Dynamic: ✔️
  • Required:

CA certificate as data

caCertFile
  • Type: string
  • Dynamic: ✔️
  • Required:

CA certificate as file path

clientCertData
  • Type: string
  • Dynamic: ✔️
  • Required:

Client certificate as data

clientCertFile
  • Type: string
  • Dynamic: ✔️
  • Required:

Client certificate as a file path

clientKeyAlgo
  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: RSA

Client key encryption algorithm

default is RSA

clientKeyData
  • Type: string
  • Dynamic: ✔️
  • Required:

Client key as data

clientKeyFile
  • Type: string
  • Dynamic: ✔️
  • Required:

Client key as a file path

clientKeyPassphrase
  • Type: string
  • Dynamic: ✔️
  • Required:

Client key passphrase

disableHostnameVerification
  • Type: boolean
  • Dynamic:
  • Required:

Disable hostname verification

keyStoreFile
  • Type: string
  • Dynamic: ✔️
  • Required:

Key store file

keyStorePassphrase
  • Type: string
  • Dynamic: ✔️
  • Required:

Key store passphrase

masterUrl
  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: https://kubernetes.default.svc

The url to the Kubernetes API

namespace
  • Type: string
  • Dynamic: ✔️
  • Required:

The namespace used

oauthToken
  • Type: string
  • Dynamic: ✔️
  • Required:

Oauth token

oauthTokenProvider

Oauth token provider

password
  • Type: string
  • Dynamic: ✔️
  • Required:

Password

trustCerts
  • Type: boolean
  • Dynamic:
  • Required:

Trust all certificates

trustStoreFile
  • Type: string
  • Dynamic: ✔️
  • Required:

Truststore file

trustStorePassphrase
  • Type: string
  • Dynamic: ✔️
  • Required:

Truststore passphrase

username
  • Type: string
  • Dynamic: ✔️
  • Required:

Username

io.fabric8.kubernetes.api.model.FieldsV1

io.kestra.plugin.kubernetes.models.Metadata

Properties

annotations
  • Type: object
  • SubType: string
  • Dynamic:
  • Required:

List of all annotations of the resource

clusterName
  • Type: string
  • Dynamic:
  • Required:

Name of the current cluster

creationTimestamp
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time

Creation datetime

deletionGracePeriodSeconds
  • Type: integer
  • Dynamic:
  • Required:

Deletetion grace period in seconds

deletionTimestamp
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time

Deletetion datetime

finalizers
  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

List of finalizers

generateName
  • Type: string
  • Dynamic:
  • Required:

Generate name of the resource

generation
  • Type: integer
  • Dynamic:
  • Required:

Generation

labels
  • Type: object
  • SubType: string
  • Dynamic:
  • Required:

List of labels

managedFields

List of managed fields

name
  • Type: string
  • Dynamic:
  • Required:

Name of the resource

namespace
  • Type: string
  • Dynamic:
  • Required:

Namespace of the resource

ownerReferences

List of owner reference

resourceVersion
  • Type: string
  • Dynamic:
  • Required:

Resource version

  • Type: string
  • Dynamic:
  • Required:

Direct link on the api of this resource

uid
  • Type: string
  • Dynamic:
  • Required:

Generated Uid of this resource

io.fabric8.kubernetes.api.model.ManagedFieldsEntry

Properties

apiVersion
  • Type: string
  • Dynamic:
  • Required:
fieldsType
  • Type: string
  • Dynamic:
  • Required:
fieldsV1
manager
  • Type: string
  • Dynamic:
  • Required:
operation
  • Type: string
  • Dynamic:
  • Required:
subresource
  • Type: string
  • Dynamic:
  • Required:
time
  • Type: string
  • Dynamic:
  • Required:

io.kestra.plugin.kubernetes.models.SideCar

Properties

image
  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: busybox

The image used for the file sidecar container.

io.kestra.plugin.kubernetes.models.OAuthTokenProvider

Properties

output
  • Type: string
  • Dynamic:
  • Required:
task
  • Type: Task
  • Dynamic:
  • Required:

io.fabric8.kubernetes.api.model.OwnerReference

Properties

apiVersion
  • Type: string
  • Dynamic:
  • Required:
blockOwnerDeletion
  • Type: boolean
  • Dynamic:
  • Required:
controller
  • Type: boolean
  • Dynamic:
  • Required:
kind
  • Type: string
  • Dynamic:
  • Required:
name
  • Type: string
  • Dynamic:
  • Required:
uid
  • Type: string
  • Dynamic:
  • Required:

Was this page helpful?