Skip to content

K8sManifest

K8sManifest deploys arbitrary Kubernetes manifests to the target cluster. Use it for resources that don’t have a dedicated Kyku resource type, or for applying pre-existing YAML files.

Supports inline manifest strings, file paths, entire directories, or raw JavaScript objects.

Property Type Required Description
cluster KubernetesCluster | string Target cluster
namespace K8sNamespace | string Default namespace for resources without one
dependsOn string[] Explicit dependency ordering
manifest string Inline YAML manifest string
manifestFile string Path to a YAML file
manifestDir string Path to a directory of YAML files (applied recursively)
manifestObject Record<string, unknown> Raw JavaScript object (converted to YAML)
prune boolean Remove resources not in the manifest (defaults to true)
forceConflicts boolean Force apply on resource conflicts (defaults to true)

At least one of manifest, manifestFile, manifestDir, or manifestObject must be provided.

// Inline manifest
const dashboard = new K8sManifest({
name: 'kubernetes-dashboard',
cluster: myCluster,
manifest: `
apiVersion: v1
kind: ServiceAccount
metadata:
name: dashboard-admin
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dashboard-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: dashboard-admin
namespace: default
`,
})
// From file
const monitoring = new K8sManifest({
name: 'prometheus-stack',
cluster: myCluster,
manifestFile: './manifests/prometheus.yaml',
prune: false,
})
// From object
const crd = new K8sManifest({
name: 'custom-resource',
cluster: myCluster,
manifestObject: {
apiVersion: 'example.com/v1',
kind: 'MyResource',
metadata: { name: 'my-instance' },
spec: { replicas: 3 },
},
})
Provider Supported
Kubernetes
Hetzner
DigitalOcean
AWS
GCP