Skip to content

K8sDeployment

K8sDeployment creates a Kubernetes Deployment in the target cluster. Deployments manage stateless pods with desired replica counts, rolling updates, and self-healing.

Property Type Required Description
cluster KubernetesCluster | string ✅ Target cluster
namespace K8sNamespace | string ❌ Namespace to deploy into
dependsOn string[] ❌ Explicit dependency ordering
image string ✅ Container image (e.g., 'nginx:1.25')
replicas number ❌ Desired pod count (defaults to 1)
ports { containerPort: number; name?: string; protocol?: string }[] ❌ Container ports to expose
env { name: string; value?: string; valueFrom?: Record }[] ❌ Environment variables
envFrom { configMapRef?: K8sConfigMap | string; secretRef?: K8sSecret | string; prefix?: string }[] ❌ Populate env from ConfigMaps or Secrets
volumeMounts { name: string; mountPath: string; readOnly?: boolean; subPath?: string }[] ❌ Volume mount definitions
volumes { name: string; configMap?: K8sConfigMap; secret?: K8sSecret; persistentVolumeClaim?: K8sPersistentVolumeClaim }[] ❌ Volume sources (references to other K8s resources)
rollingUpdate { maxSurge?: number; maxUnavailable?: number } ❌ Rolling update strategy parameters
spec Record<string, unknown> ❌ Raw pod template spec overrides (merged into the generated spec)
const appConfig = new K8sConfigMap({ ... })
const api = new K8sDeployment({
name: 'api-server',
cluster: myCluster,
namespace: myNamespace,
image: 'myapp/api:1.0.0',
replicas: 3,
ports: [{ containerPort: 8080, name: 'http' }],
env: [
{ name: 'NODE_ENV', value: 'production' },
],
envFrom: [
{ configMapRef: appConfig },
],
volumes: [
{ name: 'data', persistentVolumeClaim: myPVC },
],
volumeMounts: [
{ name: 'data', mountPath: '/var/data' },
],
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 0,
},
})
Provider Supported
Kubernetes ✅
Hetzner ❌
DigitalOcean ❌
AWS ❌
GCP ❌