Introduction
cdk8s is an open-source framework by AWS that lets you define Kubernetes manifests using familiar programming languages instead of writing raw YAML. It supports TypeScript, Python, Java, and Go, and generates standard Kubernetes YAML that works with any cluster and any deployment tool.
What cdk8s Does
- Defines Kubernetes resources as objects in TypeScript, Python, Java, or Go
- Generates standard Kubernetes YAML manifests via
cdk8s synth - Provides importable construct libraries for any CRD or Helm chart
- Supports reusable abstractions through the Constructs programming model
- Integrates with existing CI/CD pipelines by producing plain YAML output
Architecture Overview
cdk8s uses the Constructs framework (shared with AWS CDK) to model Kubernetes resources as a tree of objects. Each construct maps to one or more Kubernetes API objects. When you run cdk8s synth, the framework walks the construct tree, resolves all properties, and serializes the result into standard YAML files in the dist/ directory. No cluster connection is needed at synthesis time.
Self-Hosting & Configuration
- Install the CLI globally with
npm install -g cdk8s-cli - Initialize projects with
cdk8s initfor TypeScript, Python, Java, or Go - Import CRDs with
cdk8s import k8sorcdk8s import crds.yamlto generate typed classes - Import Helm charts with
cdk8s import helm:repo/chartfor type-safe Helm values - Apply output with
kubectl apply -f dist/or integrate into Argo CD / Flux GitOps workflows
Key Features
- Write Kubernetes manifests in TypeScript, Python, Java, or Go with full IDE support
- Auto-generate typed classes from any CRD or Helm chart via
cdk8s import - Reusable construct libraries for sharing patterns across teams
- No cluster dependency at build time; output is portable YAML
- Composable with AWS CDK via cdk8s-plus for higher-level abstractions
Comparison with Similar Tools
- Helm — template-based package manager using Go templates in YAML; cdk8s uses real programming languages with full logic and typing
- Kustomize — overlay-based YAML patching; cdk8s generates manifests from code rather than patching existing files
- Pulumi — deploys resources directly to clusters; cdk8s only generates YAML without managing state
- Jsonnet / CUE — configuration languages for structured data; cdk8s leverages general-purpose languages with richer ecosystems
- Terraform — multi-cloud IaC with state management; cdk8s focuses purely on Kubernetes manifest generation
FAQ
Q: Does cdk8s deploy to a cluster? A: No. cdk8s only generates YAML files. You deploy them with kubectl, Argo CD, Flux, or any tool that accepts Kubernetes manifests.
Q: Can I use cdk8s with existing Helm charts?
A: Yes. Use cdk8s import helm:repo/chart to generate typed constructs from any Helm chart, then configure values in code.
Q: Is cdk8s related to AWS CDK? A: They share the Constructs framework and programming model but are independent projects. cdk8s targets Kubernetes; AWS CDK targets AWS resources.
Q: What is cdk8s-plus? A: cdk8s-plus is a higher-level library that provides opinionated abstractions for common Kubernetes resources like Deployments, Services, and Ingresses.