builtin:kubectl#

Applies a manifest, a directory of manifests, or a kustomization to a Kubernetes cluster, with the kubectl command on the host. See Deploying workloads.

app: {
    uses: "builtin:kubectl"
    needs: ["cluster"]
    with: {
        kubeconfig: "${needs.cluster.out.kubeconfig}"
        context:    "${needs.cluster.out.context}"
        manifest:   "apiVersion: v1\nkind: Namespace\nmetadata:\n  name: demo\n"
    }
}
FieldTypeDefaultDescription
kubeconfigstring-Required. A path, or a "${...}" expression that reads one from needs, such as "${needs.cluster.out.kubeconfig}".
contextstring-Selects the kubeconfig context. Defaults to the kubeconfig’s current-context.
namespacestring-The target namespace for a manifest that names none.
manifeststring-Inline YAML to apply.
pathstring-A manifest file or directory, applied with -f. Relative to the project directory unless absolute.
kustomizestring-A kustomization directory, applied with kubectl -k. Relative to the project directory unless absolute.
server_sidebool-Applies with –server-side.
keepbool-Leaves the applied resources in place on teardown, instead of deleting them.

Set exactly one of manifest, path, and kustomize.

Behavior#

  • Runs kubectl apply, so running the step again is safe.
  • Deletes the applied resources on teardown, unless keep is true.
  • Does not wait for the resources to become ready. Add a builtin:wait step.