
Apply
CertifiedApply Kubernetes resources with server-side apply
Apply
Certified
Apply Kubernetes resources with server-side apply
yaml
type: io.kestra.plugin.kubernetes.kubectl.ApplyExamples
yaml
id: create_or_replace_deployment
namespace: company.team
tasks:
- id: apply
type: io.kestra.plugin.kubernetes.kubectl.Apply
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
spec: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: mypod
labels:
app: mypod
spec:
replicas: 1
selector:
matchLabels:
app: mypod
template:
metadata:
labels:
app: mypod
spec:
containers:
- name: app
image: nginx:stable-alpine
ports:
- containerPort: 80
yaml
id: create_or_replace_service
namespace: company.team
tasks:
- id: apply
type: io.kestra.plugin.kubernetes.kubectl.Apply
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
spec: |-
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: myapp
ports:
- protocol: TCP
port: 80
targetPort: 8080
yaml
id: create_or_replace_deployment
namespace: company.team
tasks:
- id: apply
type: io.kestra.plugin.kubernetes.kubectl.Apply
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
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
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
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
connection:
masterUrl: "{{ secret('K8S_MASTER_URL') }}"
oauthToken: "{{ secret('K8S_TOKEN') }}"
namespace: default
waitUntilReady: PT10M
spec: |-
apiVersion: example.com/v1
kind: MyResource
metadata:
name: my-resource
spec:
foo: bar
Properties
spec *Requiredstring
connection Non-dynamic
Definitions
io.kestra.plugin.kubernetes.models.Connection
apiVersionstring
Default
v1caCertDatastring
caCertFilestring
clientCertDatastring
clientCertFilestring
clientKeyAlgostring
Default
RSAclientKeyDatastring
clientKeyFilestring
clientKeyPassphrasestring
disableHostnameVerificationbooleanstring
keyStoreFilestring
keyStorePassphrasestring
masterUrlstring
Default
https://kubernetes.default.svcnamespacestring
oauthTokenstring
oauthTokenProvider
io.kestra.plugin.kubernetes.models.OAuthTokenProvider
cachestring
Default
PT5MFormat
durationoutputstring
task
passwordstring
trustCertsbooleanstring
trustStoreFilestring
trustStorePassphrasestring
usernamestring
containerDefaultSpec object
fileSidecar Non-dynamic
Default
{
"image": "busybox"
} Definitions
io.kestra.plugin.kubernetes.models.SideCar
defaultSpecobject
imagestring
Default
busyboxresourcesobject
inputFiles object
SubTypestring
namespace string
Default
defaultoutputFiles array
SubTypestring
pluginDefaultsRef Non-dynamicstring
waitRunning string
Default
PT1HwaitUntilReady string
Default
PT0SwaitUntilRunning string
Default
PT10MOutputs
metadata array
Definitions
io.kestra.plugin.kubernetes.models.Metadata
annotationsobject
clusterNamestring
creationTimestampstring
Format
date-timedeletionGracePeriodSecondsinteger
deletionTimestampstring
Format
date-timefinalizersarray
SubTypestring
generateNamestring
generationinteger
labelsobject
managedFieldsarray
io.fabric8.kubernetes.api.model.ManagedFieldsEntry
apiVersionstring
fieldsTypestring
fieldsV1
io.fabric8.kubernetes.api.model.FieldsV1
managerstring
operationstring
subresourcestring
timestring
namestring
namespacestring
ownerReferencesarray
io.fabric8.kubernetes.api.model.OwnerReference
apiVersionstring
blockOwnerDeletionboolean
controllerboolean
kindstring
namestring
uidstring
resourceVersionstring
selfLinkstring
uidstring